mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Merge #11200
11200: Always put a space after dyn in macro pretty-printing r=Veykril a=jplatte Fixes #11100. Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
This commit is contained in:
commit
149981fbfc
@ -938,6 +938,47 @@ struct Foo(usize);
|
|||||||
impl FooB for Foo {
|
impl FooB for Foo {
|
||||||
$0fn foo< 'lt>(& 'lt self){}
|
$0fn foo< 'lt>(& 'lt self){}
|
||||||
|
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn macro_trait_dyn_absolute_path() {
|
||||||
|
// https://github.com/rust-analyzer/rust-analyzer/issues/11100
|
||||||
|
check_assist(
|
||||||
|
add_missing_impl_members,
|
||||||
|
r#"
|
||||||
|
macro_rules! foo {
|
||||||
|
() => {
|
||||||
|
trait MacroTrait {
|
||||||
|
fn trait_method(_: &dyn ::core::marker::Sized);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foo!();
|
||||||
|
struct Foo;
|
||||||
|
|
||||||
|
impl MacroTrait for Foo {
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
r#"
|
||||||
|
macro_rules! foo {
|
||||||
|
() => {
|
||||||
|
trait MacroTrait {
|
||||||
|
fn trait_method(_: &dyn ::core::marker::Sized);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foo!();
|
||||||
|
struct Foo;
|
||||||
|
|
||||||
|
impl MacroTrait for Foo {
|
||||||
|
fn trait_method(_: &dyn ::core::marker::Sized) {
|
||||||
|
${0:todo!()}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
@ -88,7 +88,7 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode {
|
|||||||
LIFETIME_IDENT if is_next(|it| is_text(it), true) => {
|
LIFETIME_IDENT if is_next(|it| is_text(it), true) => {
|
||||||
mods.push(do_ws(after, tok));
|
mods.push(do_ws(after, tok));
|
||||||
}
|
}
|
||||||
AS_KW => {
|
AS_KW | DYN_KW => {
|
||||||
mods.push(do_ws(after, tok));
|
mods.push(do_ws(after, tok));
|
||||||
}
|
}
|
||||||
T![;] => {
|
T![;] => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user