mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Remove limit from import_map::Query
This commit is contained in:
parent
9b3052104c
commit
c3a29e5528
3 changed files with 7 additions and 44 deletions
|
@ -295,7 +295,6 @@ pub struct Query {
|
|||
search_mode: SearchMode,
|
||||
assoc_mode: AssocSearchMode,
|
||||
case_sensitive: bool,
|
||||
limit: usize,
|
||||
}
|
||||
|
||||
impl Query {
|
||||
|
@ -307,7 +306,6 @@ impl Query {
|
|||
search_mode: SearchMode::Exact,
|
||||
assoc_mode: AssocSearchMode::Include,
|
||||
case_sensitive: false,
|
||||
limit: usize::MAX,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,11 +327,6 @@ impl Query {
|
|||
Self { assoc_mode, ..self }
|
||||
}
|
||||
|
||||
/// Limits the returned number of items to `limit`.
|
||||
pub fn limit(self, limit: usize) -> Self {
|
||||
Self { limit, ..self }
|
||||
}
|
||||
|
||||
/// Respect casing of the query string when matching.
|
||||
pub fn case_sensitive(self) -> Self {
|
||||
Self { case_sensitive: true, ..self }
|
||||
|
@ -442,10 +435,6 @@ fn search_maps(
|
|||
}
|
||||
});
|
||||
res.extend(iter.map(TupleExt::head));
|
||||
|
||||
if res.len() >= query.limit {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1015,32 +1004,4 @@ pub mod fmt {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn search_limit() {
|
||||
check_search(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:dep
|
||||
//- /dep.rs crate:dep
|
||||
pub mod fmt {
|
||||
pub trait Display {
|
||||
fn fmt();
|
||||
}
|
||||
}
|
||||
#[macro_export]
|
||||
macro_rules! Fmt {
|
||||
() => {};
|
||||
}
|
||||
pub struct Fmt;
|
||||
|
||||
pub fn format() {}
|
||||
pub fn no() {}
|
||||
"#,
|
||||
"main",
|
||||
Query::new("".to_string()).fuzzy().limit(1),
|
||||
expect![[r#"
|
||||
dep::fmt::Display (t)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue