@@ -24,8 +24,8 @@ use rustc_middle::ty::{InternalSubsts, SubstsRef};
24
24
use rustc_session:: lint;
25
25
use rustc_span:: def_id:: DefId ;
26
26
use rustc_span:: def_id:: LocalDefId ;
27
- use rustc_span:: lev_distance :: {
28
- find_best_match_for_name_with_substrings , lev_distance_with_substrings ,
27
+ use rustc_span:: edit_distance :: {
28
+ edit_distance_with_substrings , find_best_match_for_name_with_substrings ,
29
29
} ;
30
30
use rustc_span:: symbol:: sym;
31
31
use rustc_span:: { symbol:: Ident , Span , Symbol , DUMMY_SP } ;
@@ -69,7 +69,7 @@ struct ProbeContext<'a, 'tcx> {
69
69
impl_dups : FxHashSet < DefId > ,
70
70
71
71
/// When probing for names, include names that are close to the
72
- /// requested name (by Levenshtein distance)
72
+ /// requested name (by edit distance)
73
73
allow_similar_names : bool ,
74
74
75
75
/// Some(candidate) if there is a private candidate
@@ -1793,7 +1793,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
1793
1793
1794
1794
/// Similarly to `probe_for_return_type`, this method attempts to find the best matching
1795
1795
/// candidate method where the method name may have been misspelled. Similarly to other
1796
- /// Levenshtein based suggestions, we provide at most one such suggestion.
1796
+ /// edit distance based suggestions, we provide at most one such suggestion.
1797
1797
fn probe_for_similar_candidate ( & mut self ) -> Result < Option < ty:: AssocItem > , MethodError < ' tcx > > {
1798
1798
debug ! ( "probing for method names similar to {:?}" , self . method_name) ;
1799
1799
@@ -2024,8 +2024,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
2024
2024
if self . matches_by_doc_alias ( x. def_id ) {
2025
2025
return true ;
2026
2026
}
2027
- match lev_distance_with_substrings ( name. as_str ( ) , x. name . as_str ( ) , max_dist)
2028
- {
2027
+ match edit_distance_with_substrings (
2028
+ name. as_str ( ) ,
2029
+ x. name . as_str ( ) ,
2030
+ max_dist,
2031
+ ) {
2029
2032
Some ( d) => d > 0 ,
2030
2033
None => false ,
2031
2034
}
0 commit comments