From 1f9e02c74e7822a490466a605fa384ce1b5e3afe Mon Sep 17 00:00:00 2001 From: Jess Balint Date: Fri, 22 May 2020 09:25:55 -0500 Subject: fix generated docs issue --- .../src/handlers/change_lifetime_anon_to_named.rs | 46 +++++++++++----------- crates/ra_assists/src/tests/generated.rs | 25 ++++++++++++ 2 files changed, 48 insertions(+), 23 deletions(-) (limited to 'crates/ra_assists') diff --git a/crates/ra_assists/src/handlers/change_lifetime_anon_to_named.rs b/crates/ra_assists/src/handlers/change_lifetime_anon_to_named.rs index 8d8f7833f..7101d9aaf 100644 --- a/crates/ra_assists/src/handlers/change_lifetime_anon_to_named.rs +++ b/crates/ra_assists/src/handlers/change_lifetime_anon_to_named.rs @@ -2,29 +2,29 @@ use crate::{AssistContext, AssistId, Assists}; use ra_syntax::{ast, ast::TypeParamsOwner, AstNode, SyntaxKind}; use std::collections::HashSet; -/// Assist: change_lifetime_anon_to_named -/// -/// Change an anonymous lifetime to a named lifetime. -/// -/// ``` -/// impl Cursor<'_<|>> { -/// fn node(self) -> &SyntaxNode { -/// match self { -/// Cursor::Replace(node) | Cursor::Before(node) => node, -/// } -/// } -/// } -/// ``` -/// -> -/// ``` -/// impl<'a> Cursor<'a> { -/// fn node(self) -> &SyntaxNode { -/// match self { -/// Cursor::Replace(node) | Cursor::Before(node) => node, -/// } -/// } -/// } -/// ``` +// Assist: change_lifetime_anon_to_named +// +// Change an anonymous lifetime to a named lifetime. +// +// ``` +// impl Cursor<'_<|>> { +// fn node(self) -> &SyntaxNode { +// match self { +// Cursor::Replace(node) | Cursor::Before(node) => node, +// } +// } +// } +// ``` +// -> +// ``` +// impl<'a> Cursor<'a> { +// fn node(self) -> &SyntaxNode { +// match self { +// Cursor::Replace(node) | Cursor::Before(node) => node, +// } +// } +// } +// ``` // FIXME: How can we handle renaming any one of multiple anonymous lifetimes? pub(crate) fn change_lifetime_anon_to_named(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { let lifetime_token = ctx.find_token_at_offset(SyntaxKind::LIFETIME)?; diff --git a/crates/ra_assists/src/tests/generated.rs b/crates/ra_assists/src/tests/generated.rs index 250e56a69..abffbf97c 100644 --- a/crates/ra_assists/src/tests/generated.rs +++ b/crates/ra_assists/src/tests/generated.rs @@ -268,6 +268,31 @@ pub mod std { pub mod collections { pub struct HashMap { } } } ) } +#[test] +fn doctest_change_lifetime_anon_to_named() { + check_doc_test( + "change_lifetime_anon_to_named", + r#####" +impl Cursor<'_<|>> { + fn node(self) -> &SyntaxNode { + match self { + Cursor::Replace(node) | Cursor::Before(node) => node, + } + } +} +"#####, + r#####" +impl<'a> Cursor<'a> { + fn node(self) -> &SyntaxNode { + match self { + Cursor::Replace(node) | Cursor::Before(node) => node, + } + } +} +"#####, + ) +} + #[test] fn doctest_change_return_type_to_result() { check_doc_test( -- cgit v1.2.3