Skip to content

Commit 5f51606

Browse files
committed
Pre fixup multiline
1 parent be2dde4 commit 5f51606

File tree

3 files changed

+110
-95
lines changed

3 files changed

+110
-95
lines changed

tests/ui/std_instead_of_core.fixed

Lines changed: 0 additions & 82 deletions
This file was deleted.

tests/ui/std_instead_of_core.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@aux-build:proc_macro_derive.rs
2+
//@no-rustfix
23

34
#![warn(clippy::std_instead_of_core)]
45
#![allow(unused_imports)]
@@ -31,6 +32,42 @@ fn std_instead_of_core() {
3132
ptr::read_unaligned,
3233
};
3334

35+
// Multiple import, some not in core/alloc, first pos
36+
use std::{io::Write as _, fmt::Debug as _, fmt::Alignment as _};
37+
//~^ ERROR: used import from `std` instead of `core`
38+
39+
// Second pos
40+
use std::{fmt::Alignment as _, io::Write as _, fmt::Debug as _};
41+
//~^ ERROR: used import from `std` instead of `core`
42+
43+
// Third pos
44+
use std::{fmt::Debug as _, fmt::Alignment as _, io::Write as _};
45+
//~^ ERROR: used import from `std` instead of `core`
46+
47+
// Multiple import, multi-line, same procedure as above
48+
#[rustfmt::skip]
49+
use std::{
50+
io::Write as _,
51+
fmt::Debug as _,
52+
fmt::Alignment as _,
53+
};
54+
55+
// Second pos
56+
#[rustfmt::skip]
57+
use std::{
58+
fmt::Alignment as _,
59+
io::Write as _,
60+
fmt::Debug as _,
61+
};
62+
63+
// Third pos
64+
#[rustfmt::skip]
65+
use std::{
66+
fmt::Alignment as _,
67+
fmt::Debug as _,
68+
io::Write as _,
69+
};
70+
3471
// Function calls
3572
let ptr = std::ptr::null::<u32>();
3673
//~^ ERROR: used import from `std` instead of `core`

tests/ui/std_instead_of_core.stderr

Lines changed: 73 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: used import from `std` instead of `core`
2-
--> tests/ui/std_instead_of_core.rs:14:9
2+
--> tests/ui/std_instead_of_core.rs:15:9
33
|
44
LL | use std::hash::Hasher;
55
| ^^^ help: consider importing the item from `core`: `core`
@@ -8,55 +8,115 @@ LL | use std::hash::Hasher;
88
= help: to override `-D warnings` add `#[allow(clippy::std_instead_of_core)]`
99

1010
error: used import from `std` instead of `core`
11-
--> tests/ui/std_instead_of_core.rs:17:11
11+
--> tests/ui/std_instead_of_core.rs:18:11
1212
|
1313
LL | use ::std::hash::Hash;
1414
| ^^^ help: consider importing the item from `core`: `core`
1515

1616
error: used import from `std` instead of `core`
17-
--> tests/ui/std_instead_of_core.rs:23:9
17+
--> tests/ui/std_instead_of_core.rs:24:9
1818
|
1919
LL | use std::fmt::{Debug, Result};
2020
| ^^^ help: consider importing the item from `core`: `core`
2121

2222
error: used import from `std` instead of `core`
23-
--> tests/ui/std_instead_of_core.rs:28:9
23+
--> tests/ui/std_instead_of_core.rs:29:9
2424
|
2525
LL | use std::{
2626
| ^^^ help: consider importing the item from `core`: `core`
2727

2828
error: used import from `std` instead of `core`
29-
--> tests/ui/std_instead_of_core.rs:35:15
29+
--> tests/ui/std_instead_of_core.rs:36:31
30+
|
31+
LL | use std::{io::Write as _, fmt::Debug as _, fmt::Alignment as _};
32+
| ^^^^^^^^^^
33+
|
34+
= help: consider importing the item from `core`
35+
36+
error: used import from `std` instead of `core`
37+
--> tests/ui/std_instead_of_core.rs:36:48
38+
|
39+
LL | use std::{io::Write as _, fmt::Debug as _, fmt::Alignment as _};
40+
| ^^^^^^^^^^^^^^
41+
|
42+
= help: consider importing the item from `core`
43+
44+
error: used import from `std` instead of `core`
45+
--> tests/ui/std_instead_of_core.rs:40:15
46+
|
47+
LL | use std::{fmt::Alignment as _, io::Write as _, fmt::Debug as _};
48+
| ^^^^^^^^^^^^^^
49+
|
50+
= help: consider importing the item from `core`
51+
52+
error: used import from `std` instead of `core`
53+
--> tests/ui/std_instead_of_core.rs:40:52
54+
|
55+
LL | use std::{fmt::Alignment as _, io::Write as _, fmt::Debug as _};
56+
| ^^^^^^^^^^
57+
|
58+
= help: consider importing the item from `core`
59+
60+
error: used import from `std` instead of `core`
61+
--> tests/ui/std_instead_of_core.rs:44:15
62+
|
63+
LL | use std::{fmt::Debug as _, fmt::Alignment as _, io::Write as _};
64+
| ^^^^^^^^^^
65+
|
66+
= help: consider importing the item from `core`
67+
68+
error: used import from `std` instead of `core`
69+
--> tests/ui/std_instead_of_core.rs:44:32
70+
|
71+
LL | use std::{fmt::Debug as _, fmt::Alignment as _, io::Write as _};
72+
| ^^^^^^^^^^^^^^
73+
|
74+
= help: consider importing the item from `core`
75+
76+
error: used import from `std` instead of `core`
77+
--> tests/ui/std_instead_of_core.rs:57:9
78+
|
79+
LL | use std::{
80+
| ^^^ help: consider importing the item from `core`: `core`
81+
82+
error: used import from `std` instead of `core`
83+
--> tests/ui/std_instead_of_core.rs:65:9
84+
|
85+
LL | use std::{
86+
| ^^^ help: consider importing the item from `core`: `core`
87+
88+
error: used import from `std` instead of `core`
89+
--> tests/ui/std_instead_of_core.rs:72:15
3090
|
3191
LL | let ptr = std::ptr::null::<u32>();
3292
| ^^^ help: consider importing the item from `core`: `core`
3393

3494
error: used import from `std` instead of `core`
35-
--> tests/ui/std_instead_of_core.rs:37:21
95+
--> tests/ui/std_instead_of_core.rs:74:21
3696
|
3797
LL | let ptr_mut = ::std::ptr::null_mut::<usize>();
3898
| ^^^ help: consider importing the item from `core`: `core`
3999

40100
error: used import from `std` instead of `core`
41-
--> tests/ui/std_instead_of_core.rs:41:16
101+
--> tests/ui/std_instead_of_core.rs:78:16
42102
|
43103
LL | let cell = std::cell::Cell::new(8u32);
44104
| ^^^ help: consider importing the item from `core`: `core`
45105

46106
error: used import from `std` instead of `core`
47-
--> tests/ui/std_instead_of_core.rs:43:27
107+
--> tests/ui/std_instead_of_core.rs:80:27
48108
|
49109
LL | let cell_absolute = ::std::cell::Cell::new(8u32);
50110
| ^^^ help: consider importing the item from `core`: `core`
51111

52112
error: used import from `std` instead of `core`
53-
--> tests/ui/std_instead_of_core.rs:52:9
113+
--> tests/ui/std_instead_of_core.rs:89:9
54114
|
55115
LL | use std::iter::Iterator;
56116
| ^^^ help: consider importing the item from `core`: `core`
57117

58118
error: used import from `std` instead of `alloc`
59-
--> tests/ui/std_instead_of_core.rs:59:9
119+
--> tests/ui/std_instead_of_core.rs:96:9
60120
|
61121
LL | use std::vec;
62122
| ^^^ help: consider importing the item from `alloc`: `alloc`
@@ -65,19 +125,19 @@ LL | use std::vec;
65125
= help: to override `-D warnings` add `#[allow(clippy::std_instead_of_alloc)]`
66126

67127
error: used import from `std` instead of `alloc`
68-
--> tests/ui/std_instead_of_core.rs:61:9
128+
--> tests/ui/std_instead_of_core.rs:98:9
69129
|
70130
LL | use std::vec::Vec;
71131
| ^^^ help: consider importing the item from `alloc`: `alloc`
72132

73133
error: used import from `alloc` instead of `core`
74-
--> tests/ui/std_instead_of_core.rs:67:9
134+
--> tests/ui/std_instead_of_core.rs:104:9
75135
|
76136
LL | use alloc::slice::from_ref;
77137
| ^^^^^ help: consider importing the item from `core`: `core`
78138
|
79139
= note: `-D clippy::alloc-instead-of-core` implied by `-D warnings`
80140
= help: to override `-D warnings` add `#[allow(clippy::alloc_instead_of_core)]`
81141

82-
error: aborting due to 12 previous errors
142+
error: aborting due to 20 previous errors
83143

0 commit comments

Comments
 (0)