mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
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 <unexge@gmail.com>
This commit is contained in:
commit
3782c78d75
@ -3,6 +3,7 @@ use syntax::{
|
|||||||
ast::{self, edit::AstNodeEdit, VisibilityOwner},
|
ast::{self, edit::AstNodeEdit, VisibilityOwner},
|
||||||
AstNode, SyntaxKind,
|
AstNode, SyntaxKind,
|
||||||
};
|
};
|
||||||
|
use test_utils::mark;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
assist_context::{AssistContext, Assists},
|
assist_context::{AssistContext, Assists},
|
||||||
@ -26,6 +27,7 @@ pub(crate) fn unmerge_use(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
|
|||||||
|
|
||||||
let tree_list = tree.syntax().parent().and_then(ast::UseTreeList::cast)?;
|
let tree_list = tree.syntax().parent().and_then(ast::UseTreeList::cast)?;
|
||||||
if tree_list.use_trees().count() < 2 {
|
if tree_list.use_trees().count() < 2 {
|
||||||
|
mark::hit!(skip_single_use_item);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +89,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn skip_single_use_item() {
|
fn skip_single_use_item() {
|
||||||
|
mark::check!(skip_single_use_item);
|
||||||
check_assist_not_applicable(
|
check_assist_not_applicable(
|
||||||
unmerge_use,
|
unmerge_use,
|
||||||
r"
|
r"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user