@@ -24,8 +24,8 @@ use rustc_middle::ty::{InternalSubsts, SubstsRef};
2424use rustc_session:: lint;
2525use rustc_span:: def_id:: DefId ;
2626use 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 ,
2929} ;
3030use rustc_span:: symbol:: sym;
3131use rustc_span:: { symbol:: Ident , Span , Symbol , DUMMY_SP } ;
@@ -69,7 +69,7 @@ struct ProbeContext<'a, 'tcx> {
6969 impl_dups : FxHashSet < DefId > ,
7070
7171 /// When probing for names, include names that are close to the
72- /// requested name (by Levenshtein distance)
72+ /// requested name (by edit distance)
7373 allow_similar_names : bool ,
7474
7575 /// Some(candidate) if there is a private candidate
@@ -1793,7 +1793,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
17931793
17941794 /// Similarly to `probe_for_return_type`, this method attempts to find the best matching
17951795 /// 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.
17971797 fn probe_for_similar_candidate ( & mut self ) -> Result < Option < ty:: AssocItem > , MethodError < ' tcx > > {
17981798 debug ! ( "probing for method names similar to {:?}" , self . method_name) ;
17991799
@@ -2024,8 +2024,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
20242024 if self . matches_by_doc_alias ( x. def_id ) {
20252025 return true ;
20262026 }
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+ ) {
20292032 Some ( d) => d > 0 ,
20302033 None => false ,
20312034 }
0 commit comments