Skip to content

Commit 2ea9c45

Browse files
authored
Used constants instead of fields (#8394)
1 parent a5973e6 commit 2ea9c45

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ dotnet_diagnostic.RCS0063.severity = warning
216216
dotnet_diagnostic.RCS1036.severity = none # see https://github.com/dotnet/roslynator/issues/1632
217217
# Remove redundant 'ToString' call.
218218
dotnet_diagnostic.RCS1097.severity = warning
219+
# Use constant instead of field.
220+
dotnet_diagnostic.RCS1187.severity = warning
219221
# Convert interpolated string to concatenation.
220222
dotnet_diagnostic.RCS1217.severity = warning
221223
# Unnecessary null-forgiving operator.

src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ namespace HotChocolate.Types.NodaTime;
1212
/// </summary>
1313
public class ZonedDateTimeType : StringToStructBaseType<ZonedDateTime>
1414
{
15-
private static readonly string s_formatString = "uuuu'-'MM'-'dd'T'HH':'mm':'ss' 'z' 'o<g>";
15+
private const string FormatString = "uuuu'-'MM'-'dd'T'HH':'mm':'ss' 'z' 'o<g>";
1616
private static readonly ZonedDateTimePattern s_default =
17-
ZonedDateTimePattern.CreateWithInvariantCulture(s_formatString, DateTimeZoneProviders.Tzdb);
17+
ZonedDateTimePattern.CreateWithInvariantCulture(FormatString, DateTimeZoneProviders.Tzdb);
1818

1919
private readonly IPattern<ZonedDateTime>[] _allowedPatterns;
2020
private readonly IPattern<ZonedDateTime> _serializationPattern;

src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/DependencyInjectionGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected override void Generate(
9999
GenerateClientForProfile(settings, factory, descriptor, profile);
100100
}
101101

102-
factory.AddClass(s_clientServiceProvider);
102+
factory.AddClass(ClientServiceProvider);
103103

104104
factory.Build(writer);
105105
}
@@ -900,7 +900,7 @@ private static ICode CreateBaseCode(CSharpSyntaxGeneratorSettings settings)
900900
.AddArgument(Sp)))));
901901
}
902902

903-
private static readonly string s_clientServiceProvider =
903+
private const string ClientServiceProvider =
904904
@"private sealed class ClientServiceProvider
905905
: System.IServiceProvider
906906
, System.IDisposable

0 commit comments

Comments
 (0)