Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor avoid-breaking-exported-api in needless_pass_by_ref_mut #11647

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Oct 9, 2023

Until now, the lint only emitted a warning, when breaking public API. Now it doesn't lint at all when the config value is not set to false, bringing it in line with the other lints using this config value.

Also ensures that this config value is documented in the lint.

changelog: none
(I don't think a changelog is necessary, since this lint is in nursery)


Fixes #11374

cc @GuillaumeGomez

Marking as draft: Does this lint even break public API? If I change a function signature from fn foo(x: &mut T) to fn foo(x: &T), I can still call it with foo(&mut x). The only "breaking" thing is that the clippy::unnecessary_mut_passed lint will complain that &mut at the callsite is not necessary, possibly trickling down to the crate user having to remote a mut from a variable. Playground.

Are there examples where this actually breaks public API, that I'm missing?

@rustbot
Copy link
Collaborator

rustbot commented Oct 9, 2023

r? @Centri3

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 9, 2023
@GuillaumeGomez
Copy link
Member

Marking as draft: Does this lint even break public API? If I change a function signature from fn foo(x: &mut T) to fn foo(x: &T), I can still call it with foo(&mut x). The only "breaking" thing is that the clippy::unnecessary_mut_passed lint will complain that &mut at the callsite is not necessary, possibly trickling down to the crate user having to remote a mut from a variable. Playground.

Are there examples where this actually breaks public API, that I'm missing?

That's actually a good question... The API changed, so I suppose it's breaking semver but it doesn't break it for the API users. Interesting.

@Centri3
Copy link
Member

Centri3 commented Oct 9, 2023

The function will no longer be FnMut but Fn, or smth like that, so it can break API. It's probably pretty rare though and this is why I was in favor of linting anyway

Don't have any examples of this but it's probably possible when passing the function to some iterator methods, like map or filter.

@flip1995
Copy link
Member Author

flip1995 commented Oct 9, 2023

The function will no longer be FnMut but Fn

Huh, isn't this only about what the function captures? But I think you're hinting to the right thing: You won't be able to pass the function as an argument to another function, expecting a Fn/FnOnce/FnMut with a &mut argument, instead of a & argument: Playground

I will run lintcheck for this lint (modified to ONLY lint public items). Let's look at some data.

@flip1995
Copy link
Member Author

flip1995 commented Oct 9, 2023

So lintcheck gave some interesting discoveries: Passing the function is only a semi-issue: You can work around that by doing something like bar(|x| foo(x)) instead of bar(foo). But that makes the code on the callsite longer. The h2 crate has an almost-use-case for this together with the futures_util::poll_fn.

Further than that, the lock_api crated showed where the &mut has a different purpose than just the mutability: To ensure that only a single reference exists at the time of calling some of the functions.

Here are the results:

clippy 0.1.75 (5ec94d2043a 2023-10-09)

Reports

target/lintcheck/sources/h2-0.3.21/src/client.rs:1431:13 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.3.21/src/share.rs:422:37 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/mutex.rs:558:30 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/mutex.rs:611:35 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/mutex.rs:629:20 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/remutex.rs:678:30 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/remutex.rs:722:35 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/remutex.rs:740:20 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1255:30 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1297:35 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1315:20 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1545:30 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1629:35 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1647:20 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1890:30 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1964:35 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lock_api-0.4.10/src/rwlock.rs:1982:20 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/nom-7.1.3/src/multi/mod.rs:625:40 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/parking_lot-0.12.1/src/condvar.rs:255:48 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/parking_lot-0.12.1/src/condvar.rs:285:22 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/parking_lot-0.12.1/src/condvar.rs:381:22 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/socket2-0.5.4/src/lib.rs:683:38 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/want-0.3.1/src/lib.rs:192:37 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"

Stats:

lint count
clippy::needless_pass_by_ref_mut 23

In conclusion, I would say that we don't want to break public API, because passing a function with &mut arguments is definitely a use case. Also the shared-unique vs immutable-mutable difference probably matters more on public API than private API, even though I see this as another big issue, where it might even be impossible for Clippy to tell when what the intention behind the &mut is. But we can work around this with applicability, lint group and a note on the lint emission.

@Centri3
Copy link
Member

Centri3 commented Oct 9, 2023

I'm not sure whether that's actually possible by just changing the signature, since yeah that is based on what it captures. It might just be that any function implements Fn + FnMut + FnOnce no matter what.

What you showed is a larger concern though which I forgot about and is already checked for by the lint for cases of this in the current crate. This might be rare enough that we can just always give a note on public items, I can't really think of any non-contrived example where somebody passes a function pointer to smth expecting Fn with those specific parameters (rather than T). Also a mutable reference to one of those parameters.

@flip1995
Copy link
Member Author

flip1995 commented Oct 9, 2023

is already checked for by the lint for cases of this in the current crate.

Ah right, I forgot about that. This is good, but on public items we can't tell. So we should definitely emit a warning there, document it in the lint documentation and apply the exported API config correctly IMO.

I can't really think of any non-contrived example where somebody passes a function pointer to smth expecting Fn with those specific parameters

See my comment above with an example from the futures_util crate.

@Centri3
Copy link
Member

Centri3 commented Oct 9, 2023

Further than that, the lock_api crated showed where the &mut has a different purpose than just the mutability: To ensure that only a single reference exists at the time of calling some of the functions.

This would not be linted as it has an unsafe block. #11624

If it's passed to another function that's both "safe" and takes &, that's unsound, even if it's encapsulated. So I think this is a non-issue. If there's no unsafe it's safe to assume exclusivity is unnecessary

@flip1995
Copy link
Member Author

flip1995 commented Oct 9, 2023

So I think this is a non-issue. If there's no unsafe it's safe to assume exclusivity is unnecessary

You are way ahead of me :D You're right.

@flip1995
Copy link
Member Author

flip1995 commented Oct 9, 2023

I'll add the warning and documentation about this in this PR and then mark it as ready for review some time this week. (I'll be at EuroRust, where I might get some time for this and other Clippy TODOs I still have)

@GuillaumeGomez
Copy link
Member

For the unsafe fn/block, we still need to wait for #11624 to be merged.

PS: I'll be at eurorust too. :D

@bors
Copy link
Collaborator

bors commented Oct 17, 2023

☔ The latest upstream changes (presumably #11622) made this pull request unmergeable. Please resolve the merge conflicts.

@flip1995 flip1995 force-pushed the needless-pass-by-ref-mut-pub-api branch from 46de00f to feabebc Compare October 21, 2023 12:26
@flip1995 flip1995 marked this pull request as ready for review October 21, 2023 12:26
@flip1995
Copy link
Member Author

@Centri3 rebased and ready for final review.

@flip1995 flip1995 force-pushed the needless-pass-by-ref-mut-pub-api branch from feabebc to 63b69fe Compare October 21, 2023 12:40
@bors
Copy link
Collaborator

bors commented Oct 24, 2023

☔ The latest upstream changes (presumably #11685) made this pull request unmergeable. Please resolve the merge conflicts.

@flip1995 flip1995 added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Oct 31, 2023
@flip1995 flip1995 changed the title Honor avoid-breaking-exported-api in needless_pass_by_ref_mut Honor avoid-breaking-exported-api in needless_pass_by_ref_mut Oct 31, 2023
@Centri3
Copy link
Member

Centri3 commented Nov 14, 2023

Seems this only needs to be blessed, after that this is ready

@flip1995
Copy link
Member Author

The failing test has a should not lint comment above it. And I have no idea how my changes could've changed the lint behavior here...

@flip1995 flip1995 force-pushed the needless-pass-by-ref-mut-pub-api branch from 63b69fe to c5bf27a Compare November 15, 2023 10:45
@bors
Copy link
Collaborator

bors commented Nov 27, 2023

☔ The latest upstream changes (presumably #11879) made this pull request unmergeable. Please resolve the merge conflicts.

@flip1995
Copy link
Member Author

flip1995 commented Dec 2, 2023

I've spent some time investigating this.

fn bar() {}  // or a `mod bar {}` or a `use` item
fn foo() {}

async fn _f(v: &mut Vec<()>) {
    let x = || v.pop();
    _ = || || x;
}

When removing anything from that reproducer, like the functions foo OR bar, the lint no longer triggers for _f. Also when changing the function body of _f, like removing the _ = || || x; makes the lint stop triggering. Moving one of the functions to after _f also makes the lint stop triggering.

So it seems like, in order to hit this, there must be at least 2 items before _f. Changing one of the functions to a module still triggers the lint. I have no idea how my changes in this PR have any influence on the behavior. I tried moving the check for exported(_api) to right before the span_lint_hir_and_then call, to rule out that my changes skip any side effects, but to no avail.

@flip1995 flip1995 force-pushed the needless-pass-by-ref-mut-pub-api branch from c5bf27a to b26c6a3 Compare December 2, 2023 11:05
@rustbot rustbot assigned xFrednet and unassigned Centri3 Mar 31, 2024
@GuillaumeGomez
Copy link
Member

I completely forgot about it. ^^'

Putting it back to my to do list.

@xFrednet
Copy link
Member

Sorry, I totally forgot about this PR, since it wasn't in my inbox anymore 🙈 I'll add it to my todo list. You'll get a review next week!

@xFrednet
Copy link
Member

I totally missed this, since it wasn't in my inbox 🙈 I'll try to review it tomorrow or otherwise early next week.

Also ping @GuillaumeGomez, if you still want to help with the review

Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

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

Sorry for the long review time, it wasn't in my inbox 🙈

Anyhow, one small nit, but the current version also looks good to me.

Comment on lines 247 to 250
let is_exported = cx.effective_visibilities.is_exported(*fn_def_id);
if self.avoid_breaking_exported_api && is_exported {
continue;
}
Copy link
Member

@xFrednet xFrednet Jul 2, 2024

Choose a reason for hiding this comment

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

I think it would be cleaner to have this check in check_fn where the function is added to NeedlessPassByRefMut::fn_def_ids_to_maybe_unused_mut. (Or where it wouldn't be added if it's exported and the config is set) But this is a viable position as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

@xFrednet
Copy link
Member

xFrednet commented Jul 2, 2024

Could you also rebase the branch? :)

Until now, the lint only emitted a warning, when breaking public API. Now it
doesn't lint at all when the config value is not set to `false`, bringing it in
line with the other lints using this config value.

Also ensures that this config value is documented in the lint.
@flip1995 flip1995 force-pushed the needless-pass-by-ref-mut-pub-api branch from b26c6a3 to 125c778 Compare July 2, 2024 17:30
@flip1995
Copy link
Member Author

flip1995 commented Jul 2, 2024

Rebased and this weird bug: #11647 (comment) is also gone. Infinite monkey problem solving never disappoints!

@xFrednet
Copy link
Member

xFrednet commented Jul 2, 2024

LGTM, thank you for the quick update =^.^=

Now, let's give our favorite non money something to do.


Roses are red,
Bors is a bot,
Not a monkey,
Just automated testing slots

@bors
Copy link
Collaborator

bors commented Jul 2, 2024

📌 Commit 125c778 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jul 2, 2024

⌛ Testing commit 125c778 with merge 51200cb...

bors added a commit that referenced this pull request Jul 2, 2024
…Frednet

Honor `avoid-breaking-exported-api` in `needless_pass_by_ref_mut`

Until now, the lint only emitted a warning, when breaking public API. Now it doesn't lint at all when the config value is not set to `false`, bringing it in line with the other lints using this config value.

Also ensures that this config value is documented in the lint.

changelog: none
(I don't think a changelog is necessary, since this lint is in `nursery`)

---

Fixes #11374

cc `@GuillaumeGomez`

Marking as draft: Does this lint even break public API? If I change a function signature from `fn foo(x: &mut T)` to `fn foo(x: &T)`, I can still call it with `foo(&mut x)`. The only "breaking" thing is that the `clippy::unnecessary_mut_passed` lint will complain that `&mut` at the callsite is not necessary, possibly trickling down to the crate user having to remote a `mut` from a variable. [Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=058165a7663902e84af1d23e35c10d66).

Are there examples where this actually breaks public API, that I'm missing?
@bors
Copy link
Collaborator

bors commented Jul 2, 2024

💔 Test failed - checks-action_test

@xFrednet
Copy link
Member

xFrednet commented Jul 2, 2024

Could you run cargo metadata-collection to update the documentation? Then you can r=me

@flip1995
Copy link
Member Author

flip1995 commented Jul 3, 2024

@bors r=xFrednet

Thanks for the review!

@bors
Copy link
Collaborator

bors commented Jul 3, 2024

📌 Commit ae47b97 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jul 3, 2024

⌛ Testing commit ae47b97 with merge 918ae1b...

@bors
Copy link
Collaborator

bors commented Jul 3, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing 918ae1b to master...

@bors bors merged commit 918ae1b into rust-lang:master Jul 3, 2024
11 checks passed
@flip1995 flip1995 deleted the needless-pass-by-ref-mut-pub-api branch July 3, 2024 08:59
@flip1995
Copy link
Member Author

flip1995 commented Jul 3, 2024

With this merged, I think we can move this lint out of nursery. Or are there any known issues left that we need to fix @GuillaumeGomez ?

@GuillaumeGomez
Copy link
Member

None that I heard of at least.

@flip1995
Copy link
Member Author

flip1995 commented Jul 3, 2024

It triggers quite a bit on the 400 most popular crates. I still have to look into the source, whether any of those are FPs.

Going through the first 10 or so I found two issues: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=90b85826ab9d38fed7ff9657f7d24287

  1. &mut (especially &mut self) is used sometimes to guarantee unique access. For example, when (mut) pointer arithmetic is involved. Removing the mut would introduce a bug
  2. mocked/empty functions (for testing) also trigger the lint

clippy 0.1.81 (f7f0cd395c0 2024-07-02)

Reports

file lint message
target/lintcheck/sources/allocator-api2-0.2.18/src/stable/vec/into_iter.rs:83:83 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/allocator-api2-0.2.18/src/stable/vec/mod.rs:1216:1216 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/anyhow-1.0.86/src/ptr.rs:55:55 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/async-io-2.3.3/src/lib.rs:446:446 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/async-io-2.3.3/src/reactor.rs:439:439 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/backtrace-0.3.73/src/print.rs:63:63 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/backtrace-0.3.73/src/print.rs:85:85 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bindgen-0.69.4/ir/analysis/derive.rs:416:416 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bindgen-0.69.4/ir/item.rs:117:117 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bindgen-0.69.4/time.rs:35:35 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bit-vec-0.7.0/src/lib.rs:1756:1756 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bitvec-1.0.1/src/boxed.rs:256:256 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bitvec-1.0.1/src/domain.rs:827:827 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bitvec-1.0.1/src/domain.rs:841:841 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bitvec-1.0.1/src/domain.rs:852:852 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bitvec-1.0.1/src/domain.rs:863:863 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bitvec-1.0.1/src/vec.rs:336:336 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/bitvec-1.0.1/src/vec.rs:370:370 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/block_splitter.rs:412:412 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/brotli_bit_stream.rs:2116:2116 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/context_map_entropy.rs:385:385 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/context_map_entropy.rs:407:407 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/encode.rs:1683:1683 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/entropy_encode.rs:28:28 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/find_stride.rs:886:886 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/worker_pool.rs:164:164 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-6.0.0/src/enc/worker_pool.rs:179:179 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-decompressor-4.0.1/src/bit_reader/mod.rs:390:390 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/brotli-decompressor-4.0.1/src/decode.rs:604:604 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/clap_builder-4.5.8/src/builder/arg_group.rs:283:283 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/clap_builder-4.5.8/src/builder/styled_str.rs:76:76 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/clap_builder-4.5.8/src/parser/parser.rs:737:737 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/clap_builder-4.5.8/src/parser/validator.rs:27:27 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/clap_builder-4.5.8/src/parser/validator.rs:89:89 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/dashmap-6.0.1/src/lib.rs:891:891 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/encoding_rs-0.8.34/src/replacement.rs:37:37 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/encoding_rs-0.8.34/src/replacement.rs:56:56 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/encoding_rs-0.8.34/src/single_byte.rs:403:403 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/encoding_rs-0.8.34/src/utf_8.rs:845:845 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/encoding_rs-0.8.34/src/utf_8.rs:863:863 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/encoding_rs-0.8.34/src/x_user_defined.rs:75:75 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/env_logger-0.11.3/src/fmt/mod.rs:151:151 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/env_logger-0.11.3/src/fmt/writer/buffer.rs:127:127 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/event-listener-5.3.1/src/lib.rs:1170:1170 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-channel-0.3.30/src/mpsc/mod.rs:805:805 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-channel-0.3.30/src/oneshot.rs:154:154 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-channel-0.3.30/src/oneshot.rs:256:256 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-channel-0.3.30/src/oneshot.rs:357:357 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-channel-0.3.30/src/oneshot.rs:438:438 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-channel-0.3.30/src/oneshot.rs:450:450 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-executor-0.3.30/src/local_pool.rs:295:295 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-util-0.3.30/src/future/future/shared.rs:208:208 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-util-0.3.30/src/stream/futures_unordered/mod.rs:248:248 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/futures-util-0.3.30/src/stream/select_all.rs:64:64 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/client.rs:1501:1501 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/hpack/encoder.rs:115:115 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/hpack/encoder.rs:157:157 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/recv.rs:1137:1137 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/recv.rs:130:130 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/recv.rs:784:784 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/recv.rs:822:822 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/recv.rs:836:836 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/send.rs:130:130 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/send.rs:321:321 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1058:1058 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1082:1082 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1102:1102 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1115:1115 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1139:1139 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1216:1216 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:121:121 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1238:1238 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1249:1249 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1293:1293 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1303:1303 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:130:130 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1330:1330 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1339:1339 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1366:1366 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1378:1378 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:157:157 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:1585:1585 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:169:169 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:178:178 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:190:190 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:211:211 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:219:219 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:334:334 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:340:340 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:345:345 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:352:352 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:357:357 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:366:366 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:371:371 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:376:376 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:381:381 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:386:386 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:947:947 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/proto/streams/streams.rs:989:989 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/share.rs:422:422 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/share.rs:556:556 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/h2-0.4.5/src/share.rs:569:569 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/hashbrown-0.14.5/src/raw/mod.rs:1487:1487 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/hashlink-0.9.1/src/linked_hash_map.rs:139:139 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/idna-1.0.2/src/deprecated.rs:109:109 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/idna-1.0.2/src/deprecated.rs:78:78 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/inout-0.2.0-pre.4/src/inout.rs:16:16 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/inout-0.2.0-pre.4/src/inout_buf.rs:138:138 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/libz-sys-1.1.18/build.rs:218:218 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/linked-hash-map-0.5.6/src/lib.rs:143:143 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/linked-hash-map-0.5.6/src/lib.rs:402:402 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/lru-0.12.3/src/lib.rs:1243:1243 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/matchit-0.8.3/src/router.rs:86:86 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/memmap2-0.9.4/src/unix.rs:361:361 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/miniz_oxide-0.7.4/src/inflate/core.rs:980:980 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/mio-1.0.0/src/poll.rs:432:432 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/object-0.36.1/src/read/read_cache.rs:90:90 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/openssl-0.10.64/src/x509/extension.rs:502:502 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/openssl-0.10.64/src/x509/extension.rs:512:512 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/pest-2.7.11/src/pratt_parser.rs:378:378 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/petgraph-0.6.5/src/algo/feedback_arc_set.rs:361:361 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/petgraph-0.6.5/src/algo/isomorphism.rs:283:283 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/petgraph-0.6.5/src/algo/isomorphism.rs:464:464 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/petgraph-0.6.5/src/algo/isomorphism.rs:508:508 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/prettyplease-0.2.20/src/expr.rs:669:669 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/prettyplease-0.2.20/src/generics.rs:147:147 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/prettyplease-0.2.20/src/pat.rs:172:172 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/prettyplease-0.2.20/src/ty.rs:166:166 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/prost-build-0.12.6/src/config.rs:1067:1067 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/quick-xml-0.35.0/src/reader/ns_reader.rs:188:188 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/quick-xml-0.35.0/src/reader/state.rs:60:60 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-automata-0.4.7/src/dfa/minimize.rs:350:350 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-automata-0.4.7/src/dfa/minimize.rs:358:358 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-automata-0.4.7/src/dfa/minimize.rs:363:363 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-automata-0.4.7/src/hybrid/regex.rs:665:665 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-automata-0.4.7/src/hybrid/regex.rs:670:670 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-automata-0.4.7/src/nfa/thompson/map.rs:158:158 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-automata-0.4.7/src/nfa/thompson/map.rs:272:272 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-syntax-0.8.4/src/ast/print.rs:62:62 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-syntax-0.8.4/src/hir/print.rs:72:72 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-syntax-0.8.4/src/hir/translate.rs:173:173 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/regex-syntax-0.8.4/src/hir/visitor.rs:161:161 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/rustix-0.38.34/src/backend/linux_raw/io/syscalls.rs:115:115 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/rustix-0.38.34/src/backend/linux_raw/io/syscalls.rs:84:84 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/rustix-0.38.34/src/backend/linux_raw/io/syscalls.rs:93:93 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/rustls-0.23.10/src/client/tls13.rs:1438:1438 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/rustls-0.23.10/src/common_state.rs:532:532 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/rustls-0.23.10/src/msgs/deframer.rs:346:346 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/rustls-0.23.10/src/server/tls13.rs:113:113 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/rustls-0.23.10/src/tls13/key_schedule.rs:217:217 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/serde_derive-1.0.203/src/bound.rs:241:241 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/serde_derive-1.0.203/src/internals/receiver.rs:291:291 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/serde_json-1.0.120/src/de.rs:634:634 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/socket2-0.5.7/src/lib.rs:695:695 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tokio-1.38.0/src/runtime/park.rs:253:253 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tokio-1.38.0/src/runtime/park.rs:258:258 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tokio-1.38.0/src/runtime/park.rs:59:59 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tokio-1.38.0/src/runtime/park.rs:65:65 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tokio-1.38.0/src/runtime/park.rs:76:76 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/toml_edit-0.22.14/src/parser/mod.rs:116:116 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tonic-0.11.0/src/codec/compression.rs:34:34 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tonic-0.11.0/src/transport/server/mod.rs:360:360 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tonic-0.11.0/src/transport/server/mod.rs:381:381 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/tonic-0.11.0/src/transport/server/mod.rs:399:399 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/vcpkg-0.2.15/src/lib.rs:1173:1173 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/vcpkg-0.2.15/src/lib.rs:1214:1214 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/walkdir-2.5.0/src/lib.rs:991:991 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/want-0.3.1/src/lib.rs:192:192 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/want-0.3.1/src/lib.rs:192:192 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"
target/lintcheck/sources/want-0.3.1/src/lib.rs:341:341 clippy::needless_pass_by_ref_mut "this argument is a mutable reference, but not used mutably"

Stats:

lint count
clippy::needless_pass_by_ref_mut 170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

needless_pass_by_ref_mut does not honor the avoid_breaking_exported_api config
6 participants