about summary refs log tree commit diff
path: root/library/std/src/sys/pal/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-22 14:22:40 +0000
committerbors <bors@rust-lang.org>2024-09-22 14:22:40 +0000
commitabdf173ef2972033e1b5ac78e1bbc886b7f871c1 (patch)
tree45b3235526e6d5163eeb2f9594935ef5c7567598 /library/std/src/sys/pal/unix/stack_overflow.rs
parent612ae353d7da0b03be3d53b02bf74b7152e412e9 (diff)
parent739ef7bf0d5686ef10e7700f34e34995936e00ff (diff)
downloadrust-abdf173ef2972033e1b5ac78e1bbc886b7f871c1.tar.gz
rust-abdf173ef2972033e1b5ac78e1bbc886b7f871c1.zip
Auto merge of #13322 - RuairidhWilliamson:anon-trait-import, r=y21
Unused trait imports (formerly anonymous trait import)

For #11969

I'm looking for help and feedback on implementing a new lint for suggesting `use ... as _` for traits where possible.

I have had a go at implementing this but I don't know if this is the best way to do it as I am new to clippy.

There are some edge cases I can think of where this doesn't work but have aired on the side of false negatives instead of false positives.

An example of a false negative. I couldn't figure out the best way to resolve an import from within clippy. The sub module imports MyAny so that cannot be anonymized but `use std::any::Any` could be. In this case it is not caught because `Any` and `MyAny` have the same DefId.
```rust
mod nested_mod_used_bad1 {
    use std::any::Any;
    use std::any::Any as MyAny;
    mod foo {
        use crate::nested_mod_used_bad1::MyAny;
        fn foo() {
            println!("{:?}", MyAny::type_id("foo"));
        }
    }
}
```

Any feedback is much appreciated.

-------
changelog: new lint: `unused_trait_names`
Diffstat (limited to 'library/std/src/sys/pal/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions