From 2ab79c6f4d972796d3fd9f4b7fae3342a551f5e8 Mon Sep 17 00:00:00 2001 From: Jess Balint Date: Wed, 20 May 2020 18:37:09 -0500 Subject: Assist: replace anonymous lifetime with a named one (fixes #4523) --- docs/user/assists.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'docs') diff --git a/docs/user/assists.md b/docs/user/assists.md index 4ad7ea59d..29b64330e 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md @@ -259,6 +259,30 @@ fn main() { } ``` +## `change_lifetime_anon_to_named` + +Change an anonymous lifetime to a named lifetime. + +```rust +// BEFORE +impl Cursor<'_<|>> { + fn node(self) -> &SyntaxNode { + match self { + Cursor::Replace(node) | Cursor::Before(node) => node, + } + } +} + +// AFTER +impl<'a> Cursor<'a> { + fn node(self) -> &SyntaxNode { + match self { + Cursor::Replace(node) | Cursor::Before(node) => node, + } + } +} +``` + ## `change_return_type_to_result` Change the function's return type to Result. -- cgit v1.2.3