7708: Format code through rust-analyzer formatter.
-use crate::{AssistId, assist_context::{AssistContext, Assists}};
-use syntax::{AstNode, SyntaxKind, SyntaxNode, SyntaxText, ast::{self, NameOwner}};
+use crate::{
+ assist_context::{AssistContext, Assists},
+ AssistId,
+};
+use syntax::{
+ ast::{self, NameOwner},
+ AstNode, SyntaxKind, SyntaxNode, SyntaxText,
+};
use test_utils::mark;
// Assist: generate_default_from_new
@@ -51,7 +57,6 @@ pub(crate) fn generate_default_from_new(acc: &mut Assists, ctx: &AssistContext)
let default_fn_syntax = default_fn_node_for_new(struct_name);
-
acc.add(
AssistId("generate_default_from_new", crate::AssistKind::Generate),
"Generate a Default impl from a new fn",
@@ -78,8 +83,9 @@ impl Default for {} {{
fn default() -> Self {{
Self::new()
}}
-}}"#
- ,struct_name)
+}}"#,
+ struct_name
+ )
}
#[cfg(test)]
@@ -157,7 +163,8 @@ impl Default for Test {
#[test]
fn new_function_with_parameters() {
mark::check!(new_function_with_parameters);
- check_assist_not_applicable(generate_default_from_new,
+ check_assist_not_applicable(
+ generate_default_from_new,
r#"
struct Example { _inner: () }
@@ -166,14 +173,15 @@ impl Example {
Self { _inner: value }
}
}
-"#
+"#,
);
}
#[test]
fn other_function_than_new() {
mark::check!(other_function_than_new);
- check_assist_not_applicable(generate_default_from_new,
+ check_assist_not_applicable(
+ generate_default_from_new,
r#"
struct Example { _inner: () }
@@ -183,7 +191,7 @@ impl Exmaple {
}
}
-"#
+"#,
);
}
@@ -210,12 +218,13 @@ impl Exmaple {
#[test]
fn standalone_new_function() {
- check_assist_not_applicable(generate_default_from_new,
+ check_assist_not_applicable(
+ generate_default_from_new,
r#"
fn n$0ew() -> u32 {
0
}
-"#
+"#,
);
}
}
