Remove unnecessary assignments to default type value

The .NET runtime initializes all fields of reference types to their default values before running the constructor. In most cases, explicitly initializing a field to its default value in a constructor is redundant, adding maintenance costs and potentially degrading performance
This commit is contained in:
Qstick 2023-01-09 21:39:55 -06:00
parent 42e45f93ac
commit 08ee2f7e32
7 changed files with 9 additions and 10 deletions

View File

@ -183,7 +183,6 @@ dotnet_diagnostic.CA1720.severity = suggestion
dotnet_diagnostic.CA1721.severity = suggestion dotnet_diagnostic.CA1721.severity = suggestion
dotnet_diagnostic.CA1724.severity = suggestion dotnet_diagnostic.CA1724.severity = suggestion
dotnet_diagnostic.CA1725.severity = suggestion dotnet_diagnostic.CA1725.severity = suggestion
dotnet_diagnostic.CA1805.severity = suggestion
dotnet_diagnostic.CA1806.severity = suggestion dotnet_diagnostic.CA1806.severity = suggestion
dotnet_diagnostic.CA1810.severity = suggestion dotnet_diagnostic.CA1810.severity = suggestion
dotnet_diagnostic.CA1812.severity = suggestion dotnet_diagnostic.CA1812.severity = suggestion

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Common.TPL
private readonly int _maxDegreeOfParallelism; private readonly int _maxDegreeOfParallelism;
/// <summary>Whether the scheduler is currently processing work items.</summary> /// <summary>Whether the scheduler is currently processing work items.</summary>
private int _delegatesQueuedOrRunning = 0; // protected by lock(_tasks) private int _delegatesQueuedOrRunning; // protected by lock(_tasks)
/// <summary> /// <summary>
/// Initializes an instance of the LimitedConcurrencyLevelTaskScheduler class with the /// Initializes an instance of the LimitedConcurrencyLevelTaskScheduler class with the

View File

@ -15,9 +15,9 @@ namespace NzbDrone.Core.Datastore
private const DbType EnumerableMultiParameter = (DbType)(-1); private const DbType EnumerableMultiParameter = (DbType)(-1);
private readonly string _paramNamePrefix; private readonly string _paramNamePrefix;
private readonly bool _requireConcreteValue = false; private readonly bool _requireConcreteValue;
private int _paramCount = 0; private int _paramCount;
private bool _gotConcreteValue = false; private bool _gotConcreteValue;
public WhereBuilder(Expression filter, bool requireConcreteValue, int seq) public WhereBuilder(Expression filter, bool requireConcreteValue, int seq)
{ {

View File

@ -33,8 +33,8 @@ namespace NzbDrone.Core.HealthCheck
private readonly ICached<HealthCheck> _healthCheckResults; private readonly ICached<HealthCheck> _healthCheckResults;
private bool _hasRunHealthChecksAfterGracePeriod = false; private bool _hasRunHealthChecksAfterGracePeriod;
private bool _isRunningHealthChecksAfterGracePeriod = false; private bool _isRunningHealthChecksAfterGracePeriod;
public HealthCheckService(IEnumerable<IProvideHealthCheck> healthChecks, public HealthCheckService(IEnumerable<IProvideHealthCheck> healthChecks,
IEventAggregator eventAggregator, IEventAggregator eventAggregator,

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Core.Indexers
public bool SupportsRss { get; set; } public bool SupportsRss { get; set; }
public bool SupportsSearch { get; set; } public bool SupportsSearch { get; set; }
public int Priority { get; set; } = 25; public int Priority { get; set; } = 25;
public int SeasonSearchMaximumSingleEpisodeAge { get; set; } = 0; public int SeasonSearchMaximumSingleEpisodeAge { get; set; }
public override bool Enable => EnableRss || EnableAutomaticSearch || EnableInteractiveSearch; public override bool Enable => EnableRss || EnableAutomaticSearch || EnableInteractiveSearch;

View File

@ -11,7 +11,7 @@ namespace NzbDrone.Core.Indexers
public class TorrentRssParser : RssParser public class TorrentRssParser : RssParser
{ {
// Use to sum/calculate Peers as Leechers+Seeders // Use to sum/calculate Peers as Leechers+Seeders
public bool CalculatePeersAsSum { get; set; } = false; public bool CalculatePeersAsSum { get; set; }
// Use the specified element name to determine the Infohash // Use the specified element name to determine the Infohash
public string InfoHashElementName { get; set; } public string InfoHashElementName { get; set; }

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Mono.Disk
private static Dictionary<string, bool> _fileSystems; private static Dictionary<string, bool> _fileSystems;
private bool _hasLoggedProcMountFailure = false; private bool _hasLoggedProcMountFailure;
public ProcMountProvider(Logger logger) public ProcMountProvider(Logger logger)
{ {