Skip to content

Commit 104a421

Browse files
authored
Rollup merge of rust-lang#128140 - veera-sivarajan:remove-ident-to-str-conversions, r=compiler-errors
Remove Unnecessary `.as_str()` Conversions Because comparing interned values is much more efficient than converting a `rustc_span::symbol::Ident` to `&str` and then doing the comparison. docs: https://doc.rust-lang.org/stable/nightly-rustc/rustc_span/symbol/struct.Ident.html#method.as_str
2 parents d146ecd + 4d5ac84 commit 104a421

File tree

1 file changed

+4
-4
lines changed
  • compiler/rustc_hir_typeck/src/method

1 file changed

+4
-4
lines changed

compiler/rustc_hir_typeck/src/method/probe.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
18461846
/// Determine if the associated item with the given DefId matches
18471847
/// the desired name via a doc alias.
18481848
fn matches_by_doc_alias(&self, def_id: DefId) -> bool {
1849-
let Some(name) = self.method_name else {
1849+
let Some(method) = self.method_name else {
18501850
return false;
18511851
};
18521852
let Some(local_def_id) = def_id.as_local() else {
@@ -1863,7 +1863,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
18631863
// #[rustc_confusables("foo", "bar"))]
18641864
for n in confusables {
18651865
if let Some(lit) = n.lit()
1866-
&& name.as_str() == lit.symbol.as_str()
1866+
&& method.name == lit.symbol
18671867
{
18681868
return true;
18691869
}
@@ -1883,14 +1883,14 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
18831883
// #[doc(alias("foo", "bar"))]
18841884
for n in nested {
18851885
if let Some(lit) = n.lit()
1886-
&& name.as_str() == lit.symbol.as_str()
1886+
&& method.name == lit.symbol
18871887
{
18881888
return true;
18891889
}
18901890
}
18911891
} else if let Some(meta) = v.meta_item()
18921892
&& let Some(lit) = meta.name_value_literal()
1893-
&& name.as_str() == lit.symbol.as_str()
1893+
&& method.name == lit.symbol
18941894
{
18951895
// #[doc(alias = "foo")]
18961896
return true;

0 commit comments

Comments
 (0)