rust/compiler/rustc_ast_pretty/src
bors 982c9c1e81 Auto merge of #125055 - nnethercote:Comment-FIXME, r=compiler-errors
Avoid clone in `Comments::next`

`Comments::next`, in `rustc_ast_pretty`, has this comment:
```
// FIXME: This shouldn't probably clone lmao
```
The obvious thing to try is to return `Option<&Comment>` instead of `Option<Comment>`. But that leads to multiple borrows all over the place, because `Comments` must be borrowed from `PrintState` and then processed by `&mut self` methods within `PrintState`.

This PR instead rearranges things so that comments are consumed as they are used, preserving the `Option<Comment>` return type without requiring any cloning.

r? `@compiler-errors`
2024-05-13 06:30:25 +00:00
..
pp Remove or downgrade unnecessary pub visibility markers. 2023-11-22 08:13:21 +11:00
pprust Auto merge of #125055 - nnethercote:Comment-FIXME, r=compiler-errors 2024-05-13 06:30:25 +00:00
helpers.rs Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
lib.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
pp.rs Remove or downgrade unnecessary pub visibility markers. 2023-11-22 08:13:21 +11:00