Fixed: Do not use Count/LongCount when Any can be used

This commit is contained in:
Qstick 2020-10-02 14:10:53 -04:00
parent 0198c7a3b1
commit 295b975046
5 changed files with 4 additions and 6 deletions

View File

@ -192,8 +192,6 @@ dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion
dotnet_diagnostic.CA1825.severity = suggestion
dotnet_diagnostic.CA1826.severity = suggestion
dotnet_diagnostic.CA1827.severity = suggestion
dotnet_diagnostic.CA1828.severity = suggestion
dotnet_diagnostic.CA2000.severity = suggestion
dotnet_diagnostic.CA2002.severity = suggestion
dotnet_diagnostic.CA2007.severity = suggestion

View File

@ -16,7 +16,7 @@ namespace NzbDrone.Common.OAuth
{
var parameters = this.Where(p => p.Name.Equals(name));
if (parameters.Count() == 0)
if (!parameters.Any())
{
return null;
}

View File

@ -205,7 +205,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
}
}
if (fanarts.Count() > 0)
if (fanarts.Any())
{
var fanartElement = new XElement("fanart");
foreach (var fanart in fanarts)

View File

@ -23,7 +23,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
var ptpIndexerOldSettings = ptpIndexers
.Where(i => (i.Settings as PassThePopcornSettings).APIUser.IsNullOrWhiteSpace()).Select(i => i.Name);
if (ptpIndexerOldSettings.Count() > 0)
if (ptpIndexerOldSettings.Any())
{
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("PtpOldSettingsCheckMessage"), string.Join(", ", ptpIndexerOldSettings)));
}

View File

@ -316,7 +316,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
}
}
if (groupedTrackedDownload.Select(c => c.ImportResult).Count(c => c.Result == ImportResultType.Imported) >= 1)
if (groupedTrackedDownload.Select(c => c.ImportResult).Any(c => c.Result == ImportResultType.Imported))
{
trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, importMovie.Id));