Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion async-stream/src/yielder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<T> Receiver<T> {

// ===== impl Enter =====

impl<'a, T> Drop for Enter<'a, T> {
impl<T> Drop for Enter<'_, T> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with the warning in this case. :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is what is also covered in single_use_lifetimes (which is allowed by default), so maybe clippy::needless_lifetimes should not warn it.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=351c8940c3d6dd7f311c7a3552280daf

warning: lifetime parameter `'a` only used once
 --> src/lib.rs:7:6
  |
7 | impl<'a, T> Drop for Enter<'a, T> {
  |      ^^ this lifetime...   -- ...is used only here
  |
note: the lint level is defined here
 --> src/lib.rs:1:9
  |
1 | #![warn(single_use_lifetimes)]
  |         ^^^^^^^^^^^^^^^^^^^^
help: elide the single-use lifetime
  |
7 - impl<'a, T> Drop for Enter<'a, T> {
7 + impl<T> Drop for Enter<'_, T> {
  |

fn drop(&mut self) {
STORE.with(|cell| cell.set(self.prev));
}
Expand Down
2 changes: 1 addition & 1 deletion async-stream/tests/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ async fn borrow_self() {
struct Data(String);

impl Data {
fn stream<'a>(&'a self) -> impl Stream<Item = &str> + 'a {
fn stream(&self) -> impl Stream<Item = &str> + '_ {
stream! {
yield &self.0[..];
}
Expand Down
Loading