about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2025-08-02 17:28:17 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2025-08-02 19:04:42 +0000
commitc0c48984b05e244fc93144d0c1d48db318639b3b (patch)
treef52f28258f3574810e48b9a817d30d1618872c60
parent6d091b2baa33698682453c7bb72809554204e434 (diff)
downloadrust-c0c48984b05e244fc93144d0c1d48db318639b3b.tar.gz
rust-c0c48984b05e244fc93144d0c1d48db318639b3b.zip
Method probe: check doc aliases after edit distance.
-rw-r--r--compiler/rustc_hir_typeck/src/method/probe.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs
index 1f3969bd93c..f5584e0596a 100644
--- a/compiler/rustc_hir_typeck/src/method/probe.rs
+++ b/compiler/rustc_hir_typeck/src/method/probe.rs
@@ -2373,17 +2373,14 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
                         if !self.is_relevant_kind_for_mode(x.kind) {
                             return false;
                         }
-                        if self.matches_by_doc_alias(x.def_id) {
-                            return true;
-                        }
-                        match edit_distance_with_substrings(
+                        if let Some(d) = edit_distance_with_substrings(
                             name.as_str(),
                             x.name().as_str(),
                             max_dist,
                         ) {
-                            Some(d) => d > 0,
-                            None => false,
+                            return d > 0;
                         }
+                        self.matches_by_doc_alias(x.def_id)
                     })
                     .copied()
                     .collect()