rust/src/libsyntax/util
Yuki Okushi 429a7e7522
Rollup merge of #67849 - cjkenn:check-sorted-words, r=estebank
Add a check for swapped words when we can't find an identifier

Fixes #66968

Couple things here:
1. The matches take the precedence of case insensitive match, then levenshtein match, then swapped words match. Doing this allows us to not even check for swapped words unless the other checks return `None`.
2. I've assumed that the swapped words check is not held to the limits of the max levenshtein distance threshold (ie. we want to try and find a match even if the levenshtein distance is very high). This means that we cannot perform this check in the `fold` that occurs after the `filter_map` call, because the candidate will be filtered out. So, I've split this into two separate `fold` calls, and had to collect the original iterator into a vec so it can be copied (I don't think we want to change the function signature to take a vec or require the `Copy` trait). An alternative implemenation may be to remove the `filter_map`, `fold` over the entire iterator, and do a check against `max_dist` inside the relevant cases there.

r? @estebank
2020-01-09 00:29:12 +09:00
..
comments move syntax::parse::lexer::comments -> syntax::util::comments 2019-11-07 13:59:13 +01:00
lev_distance add a check for variable names that might match by word 2020-01-03 15:53:03 -08:00
classify.rs Format the world 2019-12-22 17:42:47 -05:00
comments.rs Normalize syntax::source_map imports. 2020-01-02 13:57:04 +01:00
lev_distance.rs Rollup merge of #67849 - cjkenn:check-sorted-words, r=estebank 2020-01-09 00:29:12 +09:00
literal.rs Normalize syntax::symbol imports. 2020-01-02 13:57:04 +01:00
map_in_place.rs syntax::map_in_place: leave fixme 2020-01-02 19:31:38 +01:00
node_count.rs Rename syntax_pos to rustc_span in source code 2020-01-01 09:15:18 +03:00
parser.rs Normalize syntax::symbol imports. 2020-01-02 13:57:04 +01:00