mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
fix: format assist doc for sourcegen_assists_docs
This commit is contained in:
parent
998b91af9c
commit
d55d3b63cb
@ -7,35 +7,34 @@ use syntax::{
|
|||||||
|
|
||||||
use crate::assist_context::{AssistContext, Assists};
|
use crate::assist_context::{AssistContext, Assists};
|
||||||
|
|
||||||
/// Assist: generate_documentation_template
|
// Assist: generate_documentation_template
|
||||||
///
|
//
|
||||||
/// Adds a documentation template above a function definition / declaration
|
// Adds a documentation template above a function definition / declaration.
|
||||||
///
|
//
|
||||||
/// ```
|
// ```
|
||||||
/// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
|
// fn my_$0func(a: i32, b: i32) -> Result<(), std::io::Error> {
|
||||||
/// unimplemented!()
|
// unimplemented!()
|
||||||
/// }
|
// }
|
||||||
/// ```
|
// ```
|
||||||
/// ->
|
// ->
|
||||||
/// ```
|
// ```
|
||||||
/// /// .
|
// /// .
|
||||||
/// ///
|
// ///
|
||||||
/// /// # Examples
|
// /// # Examples
|
||||||
/// ///
|
// ///
|
||||||
/// /// ```rust
|
// /// ```
|
||||||
/// /// use my_crate::my_func;
|
// /// use test::my_func;
|
||||||
/// ///
|
// ///
|
||||||
/// /// let result = my_func(a, b);
|
// /// assert_eq!(my_func(a, b), );
|
||||||
/// /// assert_eq!(result, );
|
// /// ```
|
||||||
/// /// ```
|
// ///
|
||||||
/// ///
|
// /// # Errors
|
||||||
/// /// # Errors
|
// ///
|
||||||
/// ///
|
// /// This function will return an error if .
|
||||||
/// /// This function will return an error if .
|
// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
|
||||||
/// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
|
// unimplemented!()
|
||||||
/// unimplemented!()
|
// }
|
||||||
/// }
|
// ```
|
||||||
/// ```
|
|
||||||
pub(crate) fn generate_documentation_template(
|
pub(crate) fn generate_documentation_template(
|
||||||
acc: &mut Assists,
|
acc: &mut Assists,
|
||||||
ctx: &AssistContext,
|
ctx: &AssistContext,
|
||||||
|
@ -839,6 +839,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]
|
#[test]
|
||||||
fn doctest_generate_enum_as_method() {
|
fn doctest_generate_enum_as_method() {
|
||||||
check_doc_test(
|
check_doc_test(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user