mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
0ea58e2346
Since the two are counted separately elsewhere, they should get their own limits, too. The biggest problem with combining them is that paths are loosely checked by not requiring every component to match, which means that if they are short and matched loosely, they can easily find "drunk typist" matches that make no sense, like this old result: std::collections::btree_map::itermut matching slice::itermut maxEditDistance = ("slice::itermut".length) / 3 = 14 / 3 = 4 editDistance("std", "slice") = 4 editDistance("itermut", "itermut") = 0 4 + 0 <= 4 PASS Of course, `slice::itermut` should not match stuff from btreemap. `slice` should not match `std`. The new result counts them separately: maxPathEditDistance = "slice".length / 3 = 5 / 3 = 1 maxEditDistance = "itermut".length / 3 = 7 / 3 = 2 editDistance("std", "slice") = 4 4 <= 1 FAIL Effectively, this makes path queries less "typo-resistant". It's not zero, but it means `vec` won't match the `v1` prelude. Queries without parent paths are unchanged.
21 lines
796 B
JavaScript
21 lines
796 B
JavaScript
const EXPECTED = [
|
|
{
|
|
query: 'hashset::insert',
|
|
others: [
|
|
// ensure hashset::insert comes first
|
|
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
|
|
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
|
|
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
|
|
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
|
|
],
|
|
},
|
|
{
|
|
query: 'hash::insert',
|
|
others: [
|
|
// ensure hashset/hashmap::insert come first
|
|
{ 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' },
|
|
{ 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
|
|
],
|
|
},
|
|
];
|