diff options
author | Jess Balint <[email protected]> | 2020-05-21 00:37:09 +0100 |
---|---|---|
committer | Jess Balint <[email protected]> | 2020-05-22 03:04:02 +0100 |
commit | 2ab79c6f4d972796d3fd9f4b7fae3342a551f5e8 (patch) | |
tree | d9b43b01ff1f42e47e9cee9952f01cc14ed0b4f2 /docs/user | |
parent | 90332ca21901e1101154462053b50e5d2743a21c (diff) |
Assist: replace anonymous lifetime with a named one
(fixes #4523)
Diffstat (limited to 'docs/user')
-rw-r--r-- | docs/user/assists.md | 24 |
1 files changed, 24 insertions, 0 deletions
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() { | |||
259 | } | 259 | } |
260 | ``` | 260 | ``` |
261 | 261 | ||
262 | ## `change_lifetime_anon_to_named` | ||
263 | |||
264 | Change an anonymous lifetime to a named lifetime. | ||
265 | |||
266 | ```rust | ||
267 | // BEFORE | ||
268 | impl Cursor<'_<|>> { | ||
269 | fn node(self) -> &SyntaxNode { | ||
270 | match self { | ||
271 | Cursor::Replace(node) | Cursor::Before(node) => node, | ||
272 | } | ||
273 | } | ||
274 | } | ||
275 | |||
276 | // AFTER | ||
277 | impl<'a> Cursor<'a> { | ||
278 | fn node(self) -> &SyntaxNode { | ||
279 | match self { | ||
280 | Cursor::Replace(node) | Cursor::Before(node) => node, | ||
281 | } | ||
282 | } | ||
283 | } | ||
284 | ``` | ||
285 | |||
262 | ## `change_return_type_to_result` | 286 | ## `change_return_type_to_result` |
263 | 287 | ||
264 | Change the function's return type to Result. | 288 | Change the function's return type to Result. |