0

Mark GURL::ReplaceComponents as [[nodiscard]]

The ReplaceComponents method does not modify the receiver URL,
so there's no point to calling it without using the output.

Change-Id: I996903dc89fd65d03a75f08bc85c68080b3b1092
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5953913
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Commit-Queue: Matt Reichhoff <mreichhoff@chromium.org>
Reviewed-by: Matt Reichhoff <mreichhoff@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1372315}
This commit is contained in:
Chris Fredrickson
2024-10-22 21:12:21 +00:00
committed by Chromium LUCI CQ
parent c88288d04f
commit 2c058fe956
2 changed files with 2 additions and 3 deletions
components/plus_addresses/affiliations
url

@ -91,7 +91,6 @@ void PlusAddressAffiliationMatchHelper::RequestGroupInfo(
// as subdomains.
GURL::Replacements repl;
repl.SetHostStr(domain);
url.ReplaceComponents(repl);
FacetURI requested_facet =
FacetURI::FromPotentiallyInvalidSpec(url.ReplaceComponents(repl).spec());
affiliation_service_->GetGroupingInfo(

@ -173,8 +173,8 @@ class COMPONENT_EXPORT(URL) GURL {
//
// Note that this intentionally disallows direct use of url::Replacements,
// which is harder to use correctly.
GURL ReplaceComponents(const Replacements& replacements) const;
GURL ReplaceComponents(const ReplacementsW& replacements) const;
[[nodiscard]] GURL ReplaceComponents(const Replacements& replacements) const;
[[nodiscard]] GURL ReplaceComponents(const ReplacementsW& replacements) const;
// A helper function that is equivalent to replacing the path with a slash
// and clearing out everything after that. We sometimes need to know just the