mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-11 14:33:32 +00:00
fix #13105: Ignore auto-import assist on parameter names
This commit is contained in:
parent
5174d3d030
commit
dd4d3f0a09
@ -156,6 +156,8 @@ pub(super) fn find_importable_node(
|
||||
{
|
||||
ImportAssets::for_method_call(&method_under_caret, &ctx.sema)
|
||||
.zip(Some(method_under_caret.syntax().clone().into()))
|
||||
} else if let Some(_) = ctx.find_node_at_offset_with_descend::<ast::Param>() {
|
||||
None
|
||||
} else if let Some(pat) = ctx
|
||||
.find_node_at_offset_with_descend::<ast::IdentPat>()
|
||||
.filter(ast::IdentPat::is_simple_ident)
|
||||
@ -268,6 +270,20 @@ mod tests {
|
||||
assert_eq!(labels, order);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ignore_parameter_name() {
|
||||
check_assist_not_applicable(
|
||||
auto_import,
|
||||
r"
|
||||
mod foo {
|
||||
pub mod bar {}
|
||||
}
|
||||
|
||||
fn foo(bar$0: &str) {}
|
||||
",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn prefer_shorter_paths() {
|
||||
let before = r"
|
||||
|
Loading…
Reference in New Issue
Block a user