aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-15 21:06:19 +0000
committerGitHub <[email protected]>2021-01-15 21:06:19 +0000
commit3782c78d7558633be5483a04aa1c098fe76100b9 (patch)
tree6f205fb2242311173f8ac21c8e896b1da35b7b44 /crates/assists/src
parentd93d3d6d7334bc94bdbfe9f3ab50cafd0113211e (diff)
parentcbe93359545611a34bb1a6a8e99ff4621deb1197 (diff)
Merge #7290
7290: Add test mark for skipping single use item in Unmerge use assist r=Veykril a=unexge followup for https://github.com/rust-analyzer/rust-analyzer/pull/7289 Co-authored-by: unexge <[email protected]>
Diffstat (limited to 'crates/assists/src')
-rw-r--r--crates/assists/src/handlers/unmerge_use.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/assists/src/handlers/unmerge_use.rs b/crates/assists/src/handlers/unmerge_use.rs
index 6da1795da..3dbef8e51 100644
--- a/crates/assists/src/handlers/unmerge_use.rs
+++ b/crates/assists/src/handlers/unmerge_use.rs
@@ -3,6 +3,7 @@ use syntax::{
3 ast::{self, edit::AstNodeEdit, VisibilityOwner}, 3 ast::{self, edit::AstNodeEdit, VisibilityOwner},
4 AstNode, SyntaxKind, 4 AstNode, SyntaxKind,
5}; 5};
6use test_utils::mark;
6 7
7use crate::{ 8use crate::{
8 assist_context::{AssistContext, Assists}, 9 assist_context::{AssistContext, Assists},
@@ -26,6 +27,7 @@ pub(crate) fn unmerge_use(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
26 27
27 let tree_list = tree.syntax().parent().and_then(ast::UseTreeList::cast)?; 28 let tree_list = tree.syntax().parent().and_then(ast::UseTreeList::cast)?;
28 if tree_list.use_trees().count() < 2 { 29 if tree_list.use_trees().count() < 2 {
30 mark::hit!(skip_single_use_item);
29 return None; 31 return None;
30 } 32 }
31 33
@@ -87,6 +89,7 @@ mod tests {
87 89
88 #[test] 90 #[test]
89 fn skip_single_use_item() { 91 fn skip_single_use_item() {
92 mark::check!(skip_single_use_item);
90 check_assist_not_applicable( 93 check_assist_not_applicable(
91 unmerge_use, 94 unmerge_use,
92 r" 95 r"