File: suggest-remove-issue-121315.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (40 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//@ compile-flags: --edition 2021
#![deny(unused_imports, redundant_imports)]
#![allow(dead_code)]

fn test0() {
    // Test remove FlatUnused
    use std::convert::TryFrom;
    //~^ ERROR the item `TryFrom` is imported redundantly
    let _ = u32::try_from(5i32);
}

fn test1() {
    // FIXME(yukang) Test remove NestedFullUnused
    use std::convert::{TryFrom, TryInto};
    //~^ ERROR the item `TryFrom` is imported redundantly
    //~| ERROR the item `TryInto` is imported redundantly

    let _ = u32::try_from(5i32);
    let _a: i32 = u32::try_into(5u32).unwrap();
}

fn test2() {
    // FIXME(yukang): Test remove both redundant and unused
    use std::convert::{AsMut, Into};
    //~^ ERROR unused import: `AsMut`
    //~| ERROR the item `Into` is imported redundantly

    let _a: u32 = (5u8).into();
}

fn test3() {
    // Test remove NestedPartialUnused
    use std::convert::{From, Infallible};
    //~^ ERROR unused import: `From`

    trait MyTrait {}
    impl MyTrait for fn() -> Infallible {}
}

fn main() {}