1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-22 07:42:28 +00:00

Minor CS improvements in NzbDroneValidation

(cherry picked from commit 6118afa339621509aad55caf27b05e89bd0b8c74)
This commit is contained in:
Bogdan 2023-05-21 12:30:40 +03:00 committed by servarr
parent feebe6726a
commit ff138c735a
3 changed files with 3 additions and 5 deletions

View file

@ -26,8 +26,7 @@ public static bool HasErrors(this List<ValidationFailure> list)
{
foreach (var item in list)
{
var extended = item as NzbDroneValidationFailure;
if (extended != null && extended.IsWarning)
if (item is NzbDroneValidationFailure { IsWarning: true })
{
continue;
}

View file

@ -24,7 +24,7 @@ public NzbDroneValidationFailure(ValidationFailure validationFailure)
CustomState = validationFailure.CustomState;
var state = validationFailure.CustomState as NzbDroneValidationState;
IsWarning = state != null && state.IsWarning;
IsWarning = state is { IsWarning: true };
}
}
}

View file

@ -26,8 +26,7 @@ public NzbDroneValidationResult(IEnumerable<ValidationFailure> failures)
foreach (var failureBase in failures)
{
var failure = failureBase as NzbDroneValidationFailure;
if (failure == null)
if (failureBase is not NzbDroneValidationFailure failure)
{
failure = new NzbDroneValidationFailure(failureBase);
}