@@ -170,17 +170,20 @@ pub fn find_best_match_for_name(
170
170
find_best_match_for_name_impl ( false , candidates, lookup, dist)
171
171
}
172
172
173
- /// Find the best match for a give word list
173
+ /// Find the best match for multiple words
174
174
///
175
- /// This function is helpfull when we have multiple patterns for candidates, for example:
175
+ /// This function is intended for use when the desired match would never be
176
+ /// returned due to a substring in `lookup` which is superfluous.
176
177
///
177
- /// For give keyword `clippy::missing_docs`, we may have multiple candidates:
178
- /// - `clippy::missing_docs_in_private_items`
179
- /// - `clippy::erasing_op`
180
- /// - `missing_docs`
181
- ///
182
- /// We want to find the best match for the given keyword, strip a prefix to get `missing_docs`,
183
- /// then call this function with `lookups` as `["clippy::missing_docs", "missing_docs"]`
178
+ /// For example, when looking for the closest lint name to
179
+ /// `clippy:missing_docs`, we would find `clippy::erasing_op`, despite
180
+ /// `missing_docs` existing and being a better suggestion. `missing_docs`
181
+ /// would have a larger edit distance because it does not contain the
182
+ /// `clippy` tool prefix. In order to find `missing_docs`, this function
183
+ /// takes multiple lookup strings, computes the best match for each and
184
+ /// returns the match which had the lowest edit distance. In our example,
185
+ /// clippy:missing_docs` and `missing_docs` would be `lookups`, enabling
186
+ /// `missing_docs` to be the best match, as desired.
184
187
pub fn find_best_match_for_names (
185
188
candidates : & [ Symbol ] ,
186
189
lookups : & [ Symbol ] ,
0 commit comments