From 6375e8d038979a0852b990fdf94be9ef7a93cec5 Mon Sep 17 00:00:00 2001 From: andrewvk Date: Mon, 23 May 2016 11:19:19 +0300 Subject: [PATCH] Cleanup --- .../Competitions/CompetitionLimitConstants.cs | 2 -- .../CompetitionTarget.cs | 2 +- .../XmlAnnotations.cs | 4 ++-- BenchmarkDotNet/tests/PerfTestConfig.cs | 2 +- BenchmarkDotNet/tests/Properties/AssemblyInfo.cs | 1 - .../CompetitionLimitsAnalyserTest.cs | 2 +- .../CodeJam.Experimental-Tests.Performance.csproj | 2 +- .../RangesV2Alternatives/RangeAlternatives.cs | 7 +++---- Main/tests-performance/AssemblyWideConfig.cs | 1 - Main/tests-performance/Program.cs | 2 -- Main/tests/Collections/ComparerBuilderTests.cs | 7 ++++--- 11 files changed, 13 insertions(+), 19 deletions(-) diff --git a/BenchmarkDotNet/src/[L4_CompetitionLimits]/Competitions/CompetitionLimitConstants.cs b/BenchmarkDotNet/src/[L4_CompetitionLimits]/Competitions/CompetitionLimitConstants.cs index be9f6e5d5..1406c72ba 100644 --- a/BenchmarkDotNet/src/[L4_CompetitionLimits]/Competitions/CompetitionLimitConstants.cs +++ b/BenchmarkDotNet/src/[L4_CompetitionLimits]/Competitions/CompetitionLimitConstants.cs @@ -1,7 +1,5 @@ using System; -using static BenchmarkDotNet.Loggers.HostLogger; - namespace BenchmarkDotNet.Competitions { internal static class CompetitionLimitConstants diff --git a/BenchmarkDotNet/src/[L4_CompetitionLimits]/Running.Competitions.SourceAnnotations/CompetitionTarget.cs b/BenchmarkDotNet/src/[L4_CompetitionLimits]/Running.Competitions.SourceAnnotations/CompetitionTarget.cs index 13be80cdb..175d6e059 100644 --- a/BenchmarkDotNet/src/[L4_CompetitionLimits]/Running.Competitions.SourceAnnotations/CompetitionTarget.cs +++ b/BenchmarkDotNet/src/[L4_CompetitionLimits]/Running.Competitions.SourceAnnotations/CompetitionTarget.cs @@ -91,7 +91,7 @@ private bool UnionWithMax(double newMax) public bool UnionWith(CompetitionLimit newProperties) { - bool result = false; + var result = false; result |= UnionWithMin(newProperties.Min); result |= UnionWithMax(newProperties.Max); return result; diff --git a/BenchmarkDotNet/src/[L4_CompetitionLimits]/Running.Competitions.SourceAnnotations/XmlAnnotations.cs b/BenchmarkDotNet/src/[L4_CompetitionLimits]/Running.Competitions.SourceAnnotations/XmlAnnotations.cs index 6319ab48c..e4699788e 100644 --- a/BenchmarkDotNet/src/[L4_CompetitionLimits]/Running.Competitions.SourceAnnotations/XmlAnnotations.cs +++ b/BenchmarkDotNet/src/[L4_CompetitionLimits]/Running.Competitions.SourceAnnotations/XmlAnnotations.cs @@ -121,7 +121,7 @@ private static XDocument[] GetDocumentsFromLogCore(string previousLogUri) var result = new List(); var buffer = new StringBuilder(); - bool append = false; + var append = false; foreach (var logLine in File.ReadLines(previousLogUri)) { if (logLine.StartsWith(LogAnnotationStart, StringComparison.OrdinalIgnoreCase)) @@ -288,7 +288,7 @@ public static void LogAdjustedCompetitionTargets( ILogger logger) { - bool updated = false; + var updated = false; var xDoc = CreateEmptyResourceDoc(true); foreach (var competitionTarget in competitionTargets) { diff --git a/BenchmarkDotNet/tests/PerfTestConfig.cs b/BenchmarkDotNet/tests/PerfTestConfig.cs index 2233f0cb1..dca426935 100644 --- a/BenchmarkDotNet/tests/PerfTestConfig.cs +++ b/BenchmarkDotNet/tests/PerfTestConfig.cs @@ -23,7 +23,7 @@ public PerfTestConfig() : this(Platform.Host, false) { } private PerfTestConfig(Platform platform, bool noWarmup) { - var job = new Job() + var job = new Job { LaunchCount = 1, Mode = Mode.SingleRun, diff --git a/BenchmarkDotNet/tests/Properties/AssemblyInfo.cs b/BenchmarkDotNet/tests/Properties/AssemblyInfo.cs index ce0f2e09f..33fba8297 100644 --- a/BenchmarkDotNet/tests/Properties/AssemblyInfo.cs +++ b/BenchmarkDotNet/tests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/BenchmarkDotNet/tests/[L4_CompetitionLimits]/CompetitionLimitsAnalyserTest.cs b/BenchmarkDotNet/tests/[L4_CompetitionLimits]/CompetitionLimitsAnalyserTest.cs index 8c9130722..33c1c6474 100644 --- a/BenchmarkDotNet/tests/[L4_CompetitionLimits]/CompetitionLimitsAnalyserTest.cs +++ b/BenchmarkDotNet/tests/[L4_CompetitionLimits]/CompetitionLimitsAnalyserTest.cs @@ -21,7 +21,7 @@ public static class CompetitionLimitsAnalyserTest public static void TestCompetitionLimitsAnalyser() { var config = PerfTestConfig.NoWarmup; - var expectedRunCount = 2 * PerfTestConfig.ExpectedRunCountNoWarmup; + const int expectedRunCount = 2 * PerfTestConfig.ExpectedRunCountNoWarmup; Interlocked.Exchange(ref _testCount, 0); var summary = CompetitionBenchmarkRunner.Run(config); diff --git a/Experimental/tests-performance/CodeJam.Experimental-Tests.Performance.csproj b/Experimental/tests-performance/CodeJam.Experimental-Tests.Performance.csproj index 32a65b107..bc07d9806 100644 --- a/Experimental/tests-performance/CodeJam.Experimental-Tests.Performance.csproj +++ b/Experimental/tests-performance/CodeJam.Experimental-Tests.Performance.csproj @@ -72,7 +72,7 @@ - {1D650545-A151-4211-8C29-C38A939403A6} + {1d650545-a151-4211-8c29-c38a939403a6} CodeJam.BenchmarkDotNet diff --git a/Experimental/tests-performance/RangesV2Alternatives/RangeAlternatives.cs b/Experimental/tests-performance/RangesV2Alternatives/RangeAlternatives.cs index ee472eadc..ba0237843 100644 --- a/Experimental/tests-performance/RangesV2Alternatives/RangeAlternatives.cs +++ b/Experimental/tests-performance/RangesV2Alternatives/RangeAlternatives.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; @@ -77,7 +76,7 @@ public RangeStub(RangeBoundaryFrom from, RangeBoundaryTo to) public bool IsEmpty => From.IsEmpty; public bool IsNotEmpty => From.IsNotEmpty; - public RangeStub CreateRange(RangeBoundaryFrom @from, RangeBoundaryTo to) => + public RangeStub CreateRange(RangeBoundaryFrom from, RangeBoundaryTo to) => new RangeStub(from, to); public RangeStub TryCreateRange(RangeBoundaryFrom from, RangeBoundaryTo to) => @@ -122,7 +121,7 @@ public RangeStubCompact(RangeBoundaryFrom from, RangeBoundaryTo to) public bool IsEmpty => From.IsEmpty; public bool IsNotEmpty => From.IsNotEmpty; - public RangeStubCompact CreateRange(RangeBoundaryFrom @from, RangeBoundaryTo to) => + public RangeStubCompact CreateRange(RangeBoundaryFrom from, RangeBoundaryTo to) => new RangeStubCompact(from, to); public RangeStubCompact TryCreateRange(RangeBoundaryFrom from, RangeBoundaryTo to) => @@ -154,7 +153,7 @@ public RangeStub(RangeBoundaryFrom from, RangeBoundaryTo to, TKey key) public bool IsEmpty => From.IsEmpty; public bool IsNotEmpty => From.IsNotEmpty; - public RangeStub CreateRange(RangeBoundaryFrom @from, RangeBoundaryTo to) => + public RangeStub CreateRange(RangeBoundaryFrom from, RangeBoundaryTo to) => new RangeStub(from, to, Key); public RangeStub TryCreateRange(RangeBoundaryFrom from, RangeBoundaryTo to) => diff --git a/Main/tests-performance/AssemblyWideConfig.cs b/Main/tests-performance/AssemblyWideConfig.cs index a46a17317..043f4e079 100644 --- a/Main/tests-performance/AssemblyWideConfig.cs +++ b/Main/tests-performance/AssemblyWideConfig.cs @@ -1,6 +1,5 @@ using System; -using BenchmarkDotNet.Competitions; using BenchmarkDotNet.Configs; using JetBrains.Annotations; diff --git a/Main/tests-performance/Program.cs b/Main/tests-performance/Program.cs index 52edb8c13..26007c7f9 100644 --- a/Main/tests-performance/Program.cs +++ b/Main/tests-performance/Program.cs @@ -1,8 +1,6 @@ using System; using System.Diagnostics; -using BenchmarkDotNet.Helpers; - using JetBrains.Annotations; namespace CodeJam diff --git a/Main/tests/Collections/ComparerBuilderTests.cs b/Main/tests/Collections/ComparerBuilderTests.cs index 916453f65..3d11ceeac 100644 --- a/Main/tests/Collections/ComparerBuilderTests.cs +++ b/Main/tests/Collections/ComparerBuilderTests.cs @@ -151,11 +151,12 @@ public void DistinctByMember3Test() } [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - class IdentifierAttribute : Attribute + private class IdentifierAttribute : Attribute { } - class TestClass2 + [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] + private class TestClass2 { [Identifier] public int EntityType { get; set; } @@ -165,7 +166,7 @@ class TestClass2 public string Name { get; set; } } - IEnumerable GetIdentifiers(TypeAccessor typeAccessor) + private static IEnumerable GetIdentifiers(TypeAccessor typeAccessor) { foreach (var member in typeAccessor.Members) if (member.MemberInfo.GetCustomAttribute() != null)