@@ -25,8 +25,8 @@ use rustc_middle::ty::{InternalSubsts, SubstsRef};
2525use rustc_session:: lint;
2626use rustc_span:: def_id:: DefId ;
2727use 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 ,
3030} ;
3131use rustc_span:: symbol:: sym;
3232use rustc_span:: { symbol:: Ident , Span , Symbol , DUMMY_SP } ;
@@ -70,7 +70,7 @@ struct ProbeContext<'a, 'tcx> {
7070 impl_dups : FxHashSet < DefId > ,
7171
7272 /// When probing for names, include names that are close to the
73- /// requested name (by Levenshtein distance)
73+ /// requested name (by edit distance)
7474 allow_similar_names : bool ,
7575
7676 /// Some(candidate) if there is a private candidate
@@ -1794,7 +1794,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
17941794
17951795 /// Similarly to `probe_for_return_type`, this method attempts to find the best matching
17961796 /// 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.
17981798 fn probe_for_similar_candidate ( & mut self ) -> Result < Option < ty:: AssocItem > , MethodError < ' tcx > > {
17991799 debug ! ( "probing for method names similar to {:?}" , self . method_name) ;
18001800
@@ -2052,8 +2052,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
20522052 if self . matches_by_doc_alias ( x. def_id ) {
20532053 return true ;
20542054 }
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+ ) {
20572060 Some ( d) => d > 0 ,
20582061 None => false ,
20592062 }
0 commit comments