rustdoc-search: count path edits with separate edit limit
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.
2023-12-26 17:15:51 -06:00
|
|
|
// exact-check
|
|
|
|
const FILTER_CRATE = "std";
|
|
|
|
const EXPECTED = [
|
|
|
|
{
|
|
|
|
query: 'vec::intoiterator',
|
|
|
|
others: [
|
|
|
|
// trait std::iter::IntoIterator is not the first result
|
|
|
|
{ 'path': 'std::vec', 'name': 'IntoIter' },
|
|
|
|
{ 'path': 'std::vec::Vec', 'name': 'into_iter' },
|
|
|
|
{ 'path': 'std::vec::Drain', 'name': 'into_iter' },
|
|
|
|
{ 'path': 'std::vec::IntoIter', 'name': 'into_iter' },
|
|
|
|
{ 'path': 'std::vec::ExtractIf', 'name': 'into_iter' },
|
|
|
|
{ 'path': 'std::vec::Splice', 'name': 'into_iter' },
|
2024-09-22 19:35:10 -05:00
|
|
|
{ 'path': 'std::collections::vec_deque::VecDeque', 'name': 'into_iter' },
|
rustdoc-search: count path edits with separate edit limit
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.
2023-12-26 17:15:51 -06:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
query: 'vec::iter',
|
|
|
|
others: [
|
|
|
|
// std::net::ToSocketAttrs::iter should not show up here
|
|
|
|
{ 'path': 'std::vec', 'name': 'IntoIter' },
|
|
|
|
{ 'path': 'std::vec::Vec', 'name': 'from_iter' },
|
|
|
|
{ 'path': 'std::vec::Vec', 'name': 'into_iter' },
|
|
|
|
{ 'path': 'std::vec::Drain', 'name': 'into_iter' },
|
|
|
|
{ 'path': 'std::vec::IntoIter', 'name': 'into_iter' },
|
|
|
|
{ 'path': 'std::vec::ExtractIf', 'name': 'into_iter' },
|
|
|
|
{ 'path': 'std::vec::Splice', 'name': 'into_iter' },
|
2024-09-22 19:35:10 -05:00
|
|
|
{ 'path': 'std::collections::vec_deque::VecDeque', 'name': 'iter' },
|
|
|
|
{ 'path': 'std::collections::vec_deque::VecDeque', 'name': 'iter_mut' },
|
|
|
|
{ 'path': 'std::collections::vec_deque::VecDeque', 'name': 'from_iter' },
|
|
|
|
{ 'path': 'std::collections::vec_deque::VecDeque', 'name': 'into_iter' },
|
rustdoc-search: count path edits with separate edit limit
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.
2023-12-26 17:15:51 -06:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
query: 'slice::itermut',
|
|
|
|
others: [
|
|
|
|
// std::collections::btree_map::itermut should not show up here
|
|
|
|
{ 'path': 'std::slice', 'name': 'IterMut' },
|
|
|
|
{ 'path': 'std::slice', 'name': 'iter_mut' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|