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