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

iter_kv_map needs to be MSRV gated on 1.54 #11752

Closed
apoelstra opened this issue Nov 3, 2023 · 1 comment · Fixed by #11757
Closed

iter_kv_map needs to be MSRV gated on 1.54 #11752

apoelstra opened this issue Nov 3, 2023 · 1 comment · Fixed by #11757
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@apoelstra
Copy link

apoelstra commented Nov 3, 2023

Summary

The new iter_kv_map lint triggers even when clippy.toml MSRV is set before the into_keys method exists.

Reproducer

cargo new clippy-demo
echo 'msrv = "1.48.0"' > clippy.toml
echo 'use std::collections::HashMap; fn main() { let x = HashMap::<(), ()>::new(); x.into_iter().map(|(k, _)| k); }' > src/main.rs
cargo clippy

You will get a suggestion to use into_keys rather than into_iter().map. But into_keys is not available until Rust 1.54.

Version

rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-unknown-linux-gnu
release: 1.73.0
LLVM version: 17.0.2

Additional Labels

No response

@apoelstra apoelstra added the C-bug Category: Clippy is not doing the correct thing label Nov 3, 2023
@matthri
Copy link
Contributor

matthri commented Nov 3, 2023

@rustbot claim

bors added a commit that referenced this issue Nov 22, 2023
Fix iter_kv_map false positive into_keys and into_values suggestion

fixes: #11752

changelog: [`iter_kv_map`]: fix false positive: Don't suggest `into_keys()` and `into_values()` if the MSRV is to low
@bors bors closed this as completed in c24784e Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants