Minor CS improvements in NzbDroneValidation

This commit is contained in:
Bogdan 2023-05-21 12:30:40 +03:00 committed by Mark McDowall
parent 59dd3b1127
commit 6118afa339
3 changed files with 3 additions and 5 deletions

View File

@ -26,8 +26,7 @@ namespace NzbDrone.Core.Validation
{ {
foreach (var item in list) foreach (var item in list)
{ {
var extended = item as NzbDroneValidationFailure; if (item is NzbDroneValidationFailure { IsWarning: true })
if (extended != null && extended.IsWarning)
{ {
continue; continue;
} }

View File

@ -24,7 +24,7 @@ namespace NzbDrone.Core.Validation
CustomState = validationFailure.CustomState; CustomState = validationFailure.CustomState;
var state = validationFailure.CustomState as NzbDroneValidationState; var state = validationFailure.CustomState as NzbDroneValidationState;
IsWarning = state != null && state.IsWarning; IsWarning = state is { IsWarning: true };
} }
} }
} }

View File

@ -26,8 +26,7 @@ namespace NzbDrone.Core.Validation
foreach (var failureBase in failures) foreach (var failureBase in failures)
{ {
var failure = failureBase as NzbDroneValidationFailure; if (failureBase is not NzbDroneValidationFailure failure)
if (failure == null)
{ {
failure = new NzbDroneValidationFailure(failureBase); failure = new NzbDroneValidationFailure(failureBase);
} }