Skip to content

Commit 5428ebd

Browse files
alinasmirnovaAndreyAkinshin
authored andcommitted
Fixed nullability warnings in methods signatures
1 parent 516bd68 commit 5428ebd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+65
-65
lines changed

samples/BenchmarkDotNet.Samples/IntroOrderManual.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ private class Config : ManualConfig
2222
private class FastestToSlowestOrderer : IOrderer
2323
{
2424
public IEnumerable<BenchmarkCase> GetExecutionOrder(ImmutableArray<BenchmarkCase> benchmarksCase,
25-
IEnumerable<BenchmarkLogicalGroupRule> order = null) =>
25+
IEnumerable<BenchmarkLogicalGroupRule>? order = null) =>
2626
from benchmark in benchmarksCase
2727
orderby benchmark.Parameters["X"] descending,
2828
benchmark.Descriptor.WorkloadMethodDisplayInfo
@@ -39,7 +39,7 @@ public string GetLogicalGroupKey(ImmutableArray<BenchmarkCase> allBenchmarksCase
3939
benchmarkCase.Job.DisplayInfo + "_" + benchmarkCase.Parameters.DisplayInfo;
4040

4141
public IEnumerable<IGrouping<string, BenchmarkCase>> GetLogicalGroupOrder(IEnumerable<IGrouping<string, BenchmarkCase>> logicalGroups,
42-
IEnumerable<BenchmarkLogicalGroupRule> order = null) =>
42+
IEnumerable<BenchmarkLogicalGroupRule>? order = null) =>
4343
logicalGroups.OrderBy(it => it.Key);
4444

4545
public bool SeparateLogicalGroups => true;

src/BenchmarkDotNet.Diagnostics.Windows/Configs/InliningDiagnoserAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public InliningDiagnoserAttribute(bool logFailuresOnly = true, bool filterByName
1313
Config = ManualConfig.CreateEmpty().AddDiagnoser(new InliningDiagnoser(logFailuresOnly, filterByNamespace));
1414
}
1515

16-
public InliningDiagnoserAttribute(bool logFailuresOnly = true, string[] allowedNamespaces = null)
16+
public InliningDiagnoserAttribute(bool logFailuresOnly = true, string[]? allowedNamespaces = null)
1717
{
1818
Config = ManualConfig.CreateEmpty().AddDiagnoser(new InliningDiagnoser(logFailuresOnly, allowedNamespaces));
1919
}

src/BenchmarkDotNet.Diagnostics.Windows/EtwDiagnoser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private void Clear()
9797

9898
private void OnProcessExit(object sender, EventArgs e) => Session?.Dispose();
9999

100-
private static string GetSessionName(string prefix, BenchmarkCase benchmarkCase, ParameterInstances parameters = null)
100+
private static string GetSessionName(string prefix, BenchmarkCase benchmarkCase, ParameterInstances? parameters = null)
101101
{
102102
if (parameters != null && parameters.Items.Count > 0)
103103
return $"{prefix}-{benchmarkCase.FolderInfo}-{parameters.FolderInfo}";

src/BenchmarkDotNet.Diagnostics.Windows/EtwProfilerConfig.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public EtwProfilerConfig(
4141
float cpuSampleIntervalInMilliseconds = 1.0f,
4242
KernelTraceEventParser.Keywords kernelKeywords = KernelTraceEventParser.Keywords.ImageLoad | KernelTraceEventParser.Keywords.Profile,
4343
KernelTraceEventParser.Keywords kernelStackKeywords = KernelTraceEventParser.Keywords.Profile,
44-
IReadOnlyDictionary<HardwareCounter, Func<ProfileSourceInfo, int>> intervalSelectors = null,
45-
IReadOnlyCollection<(Guid providerGuid, TraceEventLevel providerLevel, ulong keywords, TraceEventProviderOptions options)> providers = null,
44+
IReadOnlyDictionary<HardwareCounter, Func<ProfileSourceInfo, int>>? intervalSelectors = null,
45+
IReadOnlyCollection<(Guid providerGuid, TraceEventLevel providerLevel, ulong keywords, TraceEventProviderOptions options)>? providers = null,
4646
bool createHeapSession = false)
4747
{
4848
CreateHeapSession = createHeapSession;

src/BenchmarkDotNet.Diagnostics.Windows/InliningDiagnoser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public InliningDiagnoser(bool logFailuresOnly = true, bool filterByNamespace = t
3535
/// </summary>
3636
/// <param name="logFailuresOnly">only the methods that failed to get inlined. True by default.</param>
3737
/// <param name="allowedNamespaces">list of namespaces from which inlining message should be print.</param>
38-
public InliningDiagnoser(bool logFailuresOnly = true, string[] allowedNamespaces = null)
38+
public InliningDiagnoser(bool logFailuresOnly = true, string[]? allowedNamespaces = null)
3939
{
4040
this.logFailuresOnly = logFailuresOnly;
4141
this.allowedNamespaces = allowedNamespaces;

src/BenchmarkDotNet/Code/EnumParam.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private EnumParam(object value, Type type)
2424
public string ToSourceCode() =>
2525
$"({type.GetCorrectCSharpTypeName()})({ToInvariantCultureString()})";
2626

27-
internal static IParam FromObject(object value, Type type = null)
27+
internal static IParam FromObject(object value, Type? type = null)
2828
{
2929
type = type ?? value.GetType();
3030
if (!type.IsEnum)

src/BenchmarkDotNet/Columns/StatisticColumn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private enum Priority
107107
private readonly IStatisticColumn parentColumn;
108108

109109
private StatisticColumn(string columnName, string legend, Func<Statistics, double> calc, Priority priority, UnitType type = UnitType.Time,
110-
IStatisticColumn parentColumn = null)
110+
IStatisticColumn? parentColumn = null)
111111
{
112112
this.calc = calc;
113113
this.priority = priority;

src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static class ConfigParser
7272
{ "fullxml", new[] { XmlExporter.Full } }
7373
};
7474

75-
public static (bool isSuccess, IConfig config, CommandLineOptions options) Parse(string[] args, ILogger logger, IConfig globalConfig = null)
75+
public static (bool isSuccess, IConfig config, CommandLineOptions options) Parse(string[] args, ILogger logger, IConfig? globalConfig = null)
7676
{
7777
(bool isSuccess, IConfig config, CommandLineOptions options) result = default;
7878

src/BenchmarkDotNet/Diagnosers/EventPipeProfiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public EventPipeProfiler() :this(profile: EventPipeProfile.CpuSampling, performE
4040
/// <param name="profile">A named pre-defined set of provider configurations that allows common tracing scenarios to be specified succinctly.</param>
4141
/// <param name="providers">A list of EventPipe providers to be enabled.</param>
4242
/// <param name="performExtraBenchmarksRun">if set to true, benchmarks will be executed one more time with the profiler attached. If set to false, there will be no extra run but the results will contain overhead. True by default.</param>
43-
public EventPipeProfiler(EventPipeProfile profile = EventPipeProfile.CpuSampling, IReadOnlyCollection<EventPipeProvider> providers = null, bool performExtraBenchmarksRun = true)
43+
public EventPipeProfiler(EventPipeProfile profile = EventPipeProfile.CpuSampling, IReadOnlyCollection<EventPipeProvider>? providers = null, bool performExtraBenchmarksRun = true)
4444
{
4545
this.performExtraBenchmarksRun = performExtraBenchmarksRun;
4646
eventPipeProviders = MapToProviders(profile, providers);

src/BenchmarkDotNet/Disassemblers/DisassemblyDiagnoserConfig.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public class DisassemblyDiagnoserConfig
2222
public DisassemblyDiagnoserConfig(
2323
int maxDepth = 1,
2424
DisassemblySyntax syntax = DisassemblySyntax.Masm,
25-
string[] filters = null,
26-
FormatterOptions formatterOptions = null,
25+
string[]? filters = null,
26+
FormatterOptions? formatterOptions = null,
2727
bool printSource = false,
2828
bool printInstructionAddresses = false,
2929
bool exportGithubMarkdown = true,

0 commit comments

Comments
 (0)