mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
982c9c1e81
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` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |