diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-30 09:01:00 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-30 09:01:00 +0100 |
commit | 5d8402817044ac4039c7315e70565d6b0414b9d3 (patch) | |
tree | cf79ec5d7d09e1e5e1dafca0e14e63d3ed409f1f /docs | |
parent | 11f74f28271279e998f28d62034bffe9cf7610a3 (diff) | |
parent | bd8aa04bae5280c9b5248413f2370f0773ac73aa (diff) |
Merge #4562
4562: Assist: replace anonymous lifetime with a named one r=matklad a=jbalint
(fixes #4523)
Co-authored-by: Jess Balint <[email protected]>
Diffstat (limited to 'docs')
-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..a1058ecde 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. |