Skip to content

Commit

Permalink
Fix IDE0057 warnings
Browse files Browse the repository at this point in the history
Fix IDE0057 warnings identified in #2003.
  • Loading branch information
martincostello committed Apr 12, 2024
1 parent 9ccc6c6 commit 69c8d51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Polly.Core/Utils/TypeNameFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public static string Format(Type type)
return type.Name;
}

return $"{type.Name.Substring(0, type.Name.Length - GenericSuffixLength)}<{Format(args[0])}>";
#if NET6_0_OR_GREATER
var nameNoAirity = type.Name[..(type.Name.Length - GenericSuffixLength)];
#else
var nameNoAirity = type.Name.Substring(0, type.Name.Length - GenericSuffixLength);
#endif

return $"{nameNoAirity}<{Format(args[0])}>";
}
}
4 changes: 4 additions & 0 deletions src/Polly/Utilities/KeyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ internal static class KeyHelper
private const int GuidPartLength = 8;

public static string GuidPart() =>
#if NET6_0_OR_GREATER
Guid.NewGuid().ToString()[..GuidPartLength];
#else
Guid.NewGuid().ToString().Substring(0, GuidPartLength);
#endif
}

0 comments on commit 69c8d51

Please sign in to comment.