Skip to content

Commit 2c16fae

Browse files
authored
remove some redundant ToString (#10051)
1 parent 85e0c0a commit 2c16fae

16 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/GitHubVulnerabilities2v3/Extensions/BlobStorageVulnerabilityWriter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ private async Task RunUpdate(string stringContentOutput, Uri indexStorageUri, st
279279
{
280280
if (indexEntries[i].Name.Equals(UPDATE_ENTRY_NAME))
281281
{
282-
indexEntries[i].Id = updateUriBuilder.Uri.AbsoluteUri.ToString();
282+
indexEntries[i].Id = updateUriBuilder.Uri.AbsoluteUri;
283283
indexEntries[i].Updated = DateTime.UtcNow;
284284
break;
285285
}
@@ -320,14 +320,14 @@ private async Task RunRegenerate(string stringContentOutput, Uri indexStorageUri
320320
new IndexEntry
321321
{
322322
Name=BASE_ENTRY_NAME,
323-
Id=baseUriBuilder.Uri.AbsoluteUri.ToString(),
323+
Id=baseUriBuilder.Uri.AbsoluteUri,
324324
Updated=updatedTime,
325325
Comment="The base data for vulnerability update periodically"
326326
},
327327
new IndexEntry
328328
{
329329
Name=UPDATE_ENTRY_NAME,
330-
Id=updateUriBuilder.Uri.AbsoluteUri.ToString(),
330+
Id=updateUriBuilder.Uri.AbsoluteUri,
331331
Updated=updatedTime,
332332
Comment="The patch data for the vulnerability. Contains all the vulnerabilities since base was last updated."
333333
},

src/NuGetGallery.Core/Diagnostics/DiagnosticsServiceExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static IDiagnosticsSource SafeGetSource(this IDiagnosticsService self, st
1919
}
2020
catch(Exception ex)
2121
{
22-
System.Diagnostics.Trace.WriteLine("Error getting trace source: " + ex.ToString());
22+
System.Diagnostics.Trace.WriteLine($"Error getting trace source: {ex}");
2323
return NullDiagnosticsSource.Instance;
2424
}
2525
}

src/NuGetGallery.Core/Services/CloudBlobCoreFileStorageService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,14 @@ private async Task<string> CopyFileAsync(
197197
_trace.TraceEvent(
198198
LogLevel.Information,
199199
eventId: 0,
200-
message: $"Source blob ('{srcBlob.Uri.ToString()}') doesn't have the Sha512 hash.");
200+
message: $"Source blob ('{srcBlob.Uri}') doesn't have the Sha512 hash.");
201201
}
202202
if (!destinationBlobHasSha512Hash)
203203
{
204204
_trace.TraceEvent(
205205
LogLevel.Information,
206206
eventId: 0,
207-
message: $"Destination blob ('{destBlob.Uri.ToString()}') doesn't have the Sha512 hash.");
207+
message: $"Destination blob ('{destBlob.Uri}') doesn't have the Sha512 hash.");
208208
}
209209
if (sourceBlobHasSha512Hash && destinationBlobHasSha512Hash && sourceBlobSha512Hash == destinationBlobSha512Hash && srcBlob.Properties.Length == destBlob.Properties.Length)
210210
{

src/NuGetGallery.Services/Storage/ContentService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private async Task<IHtmlString> GetContentItemCore(string name, string[] extensi
7575
ContentItem cachedItem = null;
7676
if (ContentCache.TryGetValue(name, out cachedItem) && DateTime.UtcNow < cachedItem.ExpiryUtc)
7777
{
78-
Trace.Verbose("Cache Valid. Expires at: " + cachedItem.ExpiryUtc.ToString());
78+
Trace.Verbose("Cache Valid. Expires at: " + cachedItem.ExpiryUtc);
7979
return cachedItem.Content;
8080
}
8181
Trace.Verbose("Cache Expired.");

src/NuGetGallery/App_Code/ViewHelpers.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ string dataKey = "___AccordionCounter_" + groupName;
415415
int lastId = (int)(HttpContext.Current.Items[dataKey] ?? 0);
416416
int id = lastId + 1;
417417
HttpContext.Current.Items[dataKey] = id;
418-
string name = groupName + "-" + id.ToString();
418+
string name = groupName + "-" + id;
419419
string actionsId = name + "-actions";
420420

421421
var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);

src/NuGetGallery/Helpers/ViewModelExtensions/ListPackageItemViewModelFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private ListPackageItemViewModel SetupInternal(ListPackageItemViewModel viewMode
7171
viewModel.CanDeprecate = CanPerformAction(currentUser, package, ActionsRequiringPermissions.DeprecatePackage);
7272
viewModel.CanDisplayTfmBadges = _featureFlagService.IsDisplayTfmBadgesEnabled(currentUser);
7373

74-
PackageFrameworkCompatibility packageFrameworkCompatibility = _frameworkCompatibilityFactory.Create(package.SupportedFrameworks, package.Id, package.Version.ToString(), includeComputedBadges);
74+
PackageFrameworkCompatibility packageFrameworkCompatibility = _frameworkCompatibilityFactory.Create(package.SupportedFrameworks, package.Id, package.Version, includeComputedBadges);
7575
viewModel.FrameworkBadges = viewModel.CanDisplayTfmBadges ? packageFrameworkCompatibility?.Badges : new PackageFrameworkCompatibilityBadges();
7676

7777
viewModel.SetShortDescriptionFrom(viewModel.Description);

src/NuGetGallery/Infrastructure/Lucene/ExternalSearchService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private async Task EnsureDiagnostics()
162162
var resp = await _searchClient.GetDiagnostics();
163163
if (!resp.IsSuccessStatusCode)
164164
{
165-
Trace.Error("HTTP Error when retrieving diagnostics: " + ((int)resp.StatusCode).ToString());
165+
Trace.Error("HTTP Error when retrieving diagnostics: " + ((int)resp.StatusCode));
166166
_diagCache = new JObject();
167167
}
168168
else

src/NuGetGallery/Infrastructure/TracingHttpHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
2525
resp = await base.SendAsync(request, cancellationToken);
2626
}
2727

28-
string message = ((int)resp.StatusCode).ToString() + " " + request.RequestUri.AbsoluteUri;
28+
string message = ((int)resp.StatusCode) + " " + request.RequestUri.AbsoluteUri;
2929
if (resp.IsSuccessStatusCode)
3030
{
3131
Trace.Information(message);

src/NuGetGallery/Telemetry/CustomerResourceIdEnricher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CustomerResourceIdEnricher : ITelemetryInitializer
1515
private const string CustomerResourceId = "CustomerResourceId";
1616
private const string CustomerResourceIdConstant = "CustomerResourceIdConstant";
1717
private const string Prefix = "/tenants/";
18-
private static readonly string Empty = Prefix + Guid.Empty.ToString();
18+
private static readonly string Empty = Prefix + Guid.Empty;
1919

2020
private static readonly HashSet<string> CustomMetricNames = new HashSet<string>
2121
{

tests/NuGetGallery.Core.Facts/TestUtils/BlobStorageFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private void DeleteTestBlobs(string connectionString)
7676
foreach (var container in containers)
7777
{
7878
var blobs = container.ListBlobs(
79-
prefix: TestRunId.ToString(),
79+
prefix: TestRunId,
8080
useFlatBlobListing: true);
8181

8282
foreach (var blob in blobs.OfType<CloudBlockBlob>())

0 commit comments

Comments
 (0)