about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCôme ALLART <come.allart@etu.emse.fr>2021-12-06 19:04:44 +0100
committerCôme ALLART <come.allart@etu.emse.fr>2021-12-06 19:04:44 +0100
commitd55d3b63cb5276e3aa4681ca256565b64037d80d (patch)
treecd3a8fa1a1280bc03772a7b38d2f889bca6a883f
parent998b91af9c5bc4d1515f4a219cbcb8e941ab6eef (diff)
downloadrust-d55d3b63cb5276e3aa4681ca256565b64037d80d.tar.gz
rust-d55d3b63cb5276e3aa4681ca256565b64037d80d.zip
fix: format assist doc for sourcegen_assists_docs
-rw-r--r--crates/ide_assists/src/handlers/generate_documentation_template.rs57
-rw-r--r--crates/ide_assists/src/tests/generated.rs30
2 files changed, 58 insertions, 29 deletions
diff --git a/crates/ide_assists/src/handlers/generate_documentation_template.rs b/crates/ide_assists/src/handlers/generate_documentation_template.rs
index 3abdddbb8cb..8500a4d254c 100644
--- a/crates/ide_assists/src/handlers/generate_documentation_template.rs
+++ b/crates/ide_assists/src/handlers/generate_documentation_template.rs
@@ -7,35 +7,34 @@ use syntax::{
 
 use crate::assist_context::{AssistContext, Assists};
 
-/// Assist: generate_documentation_template
-///
-/// Adds a documentation template above a function definition / declaration
-///
-/// ```
-/// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
-///     unimplemented!()
-/// }
-/// ```
-/// ->
-/// ```
-/// /// .
-/// ///
-/// /// # Examples
-/// ///
-/// /// ```rust
-/// /// use my_crate::my_func;
-/// ///
-/// /// let result = my_func(a, b);
-/// /// assert_eq!(result, );
-/// /// ```
-/// ///
-/// /// # Errors
-/// ///
-/// /// This function will return an error if .
-/// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
-///     unimplemented!()
-/// }
-/// ```
+// Assist: generate_documentation_template
+//
+// Adds a documentation template above a function definition / declaration.
+//
+// ```
+// fn my_$0func(a: i32, b: i32) -> Result<(), std::io::Error> {
+//     unimplemented!()
+// }
+// ```
+// ->
+// ```
+// /// .
+// ///
+// /// # Examples
+// ///
+// /// ```
+// /// use test::my_func;
+// ///
+// /// assert_eq!(my_func(a, b), );
+// /// ```
+// ///
+// /// # Errors
+// ///
+// /// This function will return an error if .
+// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
+//     unimplemented!()
+// }
+// ```
 pub(crate) fn generate_documentation_template(
     acc: &mut Assists,
     ctx: &AssistContext,
diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs
index e30f98bcd13..653e51c8372 100644
--- a/crates/ide_assists/src/tests/generated.rs
+++ b/crates/ide_assists/src/tests/generated.rs
@@ -840,6 +840,36 @@ struct Point {
 }
 
 #[test]
+fn doctest_generate_documentation_template() {
+    check_doc_test(
+        "generate_documentation_template",
+        r#####"
+fn my_$0func(a: i32, b: i32) -> Result<(), std::io::Error> {
+    unimplemented!()
+}
+"#####,
+        r#####"
+/// .
+///
+/// # Examples
+///
+/// ```
+/// use test::my_func;
+///
+/// assert_eq!(my_func(a, b), );
+/// ```
+///
+/// # Errors
+///
+/// This function will return an error if .
+fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
+    unimplemented!()
+}
+"#####,
+    )
+}
+
+#[test]
 fn doctest_generate_enum_as_method() {
     check_doc_test(
         "generate_enum_as_method",