Skip to content

Commit b192f2c

Browse files
committed
Use primitive type assoc consts in more tests
1 parent c2f67e1 commit b192f2c

10 files changed

+41
-41
lines changed

tests/ui/absurd-extreme-comparisons.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ fn main() {
1616
u < Z;
1717
Z >= u;
1818
Z > u;
19-
u > std::u32::MAX;
20-
u >= std::u32::MAX;
21-
std::u32::MAX < u;
22-
std::u32::MAX <= u;
19+
u > u32::MAX;
20+
u >= u32::MAX;
21+
u32::MAX < u;
22+
u32::MAX <= u;
2323
1-1 > u;
2424
u >= !0;
2525
u <= 12 - 2*6;
2626
let i: i8 = 0;
2727
i < -127 - 1;
28-
std::i8::MAX >= i;
29-
3-7 < std::i32::MIN;
28+
i8::MAX >= i;
29+
3-7 < i32::MIN;
3030
let b = false;
3131
b >= true;
3232
false > b;
@@ -52,10 +52,10 @@ impl PartialOrd<u32> for U {
5252
}
5353

5454
pub fn foo(val: U) -> bool {
55-
val > std::u32::MAX
55+
val > u32::MAX
5656
}
5757

5858
pub fn bar(len: u64) -> bool {
5959
// This is OK as we are casting from target sized to fixed size
60-
len >= std::usize::MAX as u64
60+
len >= usize::MAX as u64
6161
}

tests/ui/absurd-extreme-comparisons.stderr

+18-18
Original file line numberDiff line numberDiff line change
@@ -42,34 +42,34 @@ LL | Z > u;
4242
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
4343
--> $DIR/absurd-extreme-comparisons.rs:19:5
4444
|
45-
LL | u > std::u32::MAX;
46-
| ^^^^^^^^^^^^^^^^^
45+
LL | u > u32::MAX;
46+
| ^^^^^^^^^^^^
4747
|
48-
= help: because `std::u32::MAX` is the maximum value for this type, this comparison is always false
48+
= help: because `u32::MAX` is the maximum value for this type, this comparison is always false
4949

5050
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
5151
--> $DIR/absurd-extreme-comparisons.rs:20:5
5252
|
53-
LL | u >= std::u32::MAX;
54-
| ^^^^^^^^^^^^^^^^^^
53+
LL | u >= u32::MAX;
54+
| ^^^^^^^^^^^^^
5555
|
56-
= help: because `std::u32::MAX` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `u == std::u32::MAX` instead
56+
= help: because `u32::MAX` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `u == u32::MAX` instead
5757

5858
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
5959
--> $DIR/absurd-extreme-comparisons.rs:21:5
6060
|
61-
LL | std::u32::MAX < u;
62-
| ^^^^^^^^^^^^^^^^^
61+
LL | u32::MAX < u;
62+
| ^^^^^^^^^^^^
6363
|
64-
= help: because `std::u32::MAX` is the maximum value for this type, this comparison is always false
64+
= help: because `u32::MAX` is the maximum value for this type, this comparison is always false
6565

6666
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
6767
--> $DIR/absurd-extreme-comparisons.rs:22:5
6868
|
69-
LL | std::u32::MAX <= u;
70-
| ^^^^^^^^^^^^^^^^^^
69+
LL | u32::MAX <= u;
70+
| ^^^^^^^^^^^^^
7171
|
72-
= help: because `std::u32::MAX` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `std::u32::MAX == u` instead
72+
= help: because `u32::MAX` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `u32::MAX == u` instead
7373

7474
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
7575
--> $DIR/absurd-extreme-comparisons.rs:23:5
@@ -106,18 +106,18 @@ LL | i < -127 - 1;
106106
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
107107
--> $DIR/absurd-extreme-comparisons.rs:28:5
108108
|
109-
LL | std::i8::MAX >= i;
110-
| ^^^^^^^^^^^^^^^^^
109+
LL | i8::MAX >= i;
110+
| ^^^^^^^^^^^^
111111
|
112-
= help: because `std::i8::MAX` is the maximum value for this type, this comparison is always true
112+
= help: because `i8::MAX` is the maximum value for this type, this comparison is always true
113113

114114
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
115115
--> $DIR/absurd-extreme-comparisons.rs:29:5
116116
|
117-
LL | 3-7 < std::i32::MIN;
118-
| ^^^^^^^^^^^^^^^^^^^
117+
LL | 3-7 < i32::MIN;
118+
| ^^^^^^^^^^^^^^
119119
|
120-
= help: because `std::i32::MIN` is the minimum value for this type, this comparison is always false
120+
= help: because `i32::MIN` is the minimum value for this type, this comparison is always false
121121

122122
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
123123
--> $DIR/absurd-extreme-comparisons.rs:31:5

tests/ui/crashes/mut_mut_macro.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
const BAA: *const i32 = 0 as *const i32;
1717
static mut BAR: *const i32 = BAA;
1818
static mut FOO: *const i32 = 0 as *const i32;
19-
static mut BUH: bool = 42.0 < std::f32::NAN;
19+
static mut BUH: bool = 42.0 < f32::NAN;
2020

2121
#[allow(unused_variables, unused_mut)]
2222
fn main() {
@@ -32,5 +32,5 @@ fn main() {
3232
assert_eq!(*MUT_COUNT, 1);
3333
*/
3434
// FIXME: don't lint in array length, requires `check_body`
35-
//let _ = [""; (42.0 < std::f32::NAN) as usize];
35+
//let _ = [""; (42.0 < f32::NAN) as usize];
3636
}

tests/ui/enum_clike_unportable_variant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ enum NonPortableSigned {
2424
Y = 0x7FFF_FFFF,
2525
Z = 0xFFFF_FFFF,
2626
A = 0x1_0000_0000,
27-
B = std::i32::MIN as isize,
28-
C = (std::i32::MIN as isize) - 1,
27+
B = i32::MIN as isize,
28+
C = (i32::MIN as isize) - 1,
2929
}
3030

3131
enum NonPortableSignedNoHint {

tests/ui/enum_clike_unportable_variant.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ LL | A = 0x1_0000_0000,
3333
error: Clike enum variant discriminant is not portable to 32-bit targets
3434
--> $DIR/enum_clike_unportable_variant.rs:28:5
3535
|
36-
LL | C = (std::i32::MIN as isize) - 1,
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
LL | C = (i32::MIN as isize) - 1,
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3838

3939
error: Clike enum variant discriminant is not portable to 32-bit targets
4040
--> $DIR/enum_clike_unportable_variant.rs:34:5

tests/ui/float_cmp.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ impl PartialEq for X {
4545

4646
fn main() {
4747
ZERO == 0f32; //no error, comparison with zero is ok
48-
1.0f32 != ::std::f32::INFINITY; // also comparison with infinity
49-
1.0f32 != ::std::f32::NEG_INFINITY; // and negative infinity
48+
1.0f32 != f32::INFINITY; // also comparison with infinity
49+
1.0f32 != f32::NEG_INFINITY; // and negative infinity
5050
ZERO == 0.0; //no error, comparison with zero is ok
5151
ZERO + ZERO != 1.0; //no error, comparison with zero is ok
5252

tests/ui/float_cmp_const.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ fn main() {
3737
// no errors, zero and infinity values
3838
ONE != 0f32;
3939
TWO == 0f32;
40-
ONE != ::std::f32::INFINITY;
41-
ONE == ::std::f32::NEG_INFINITY;
40+
ONE != f32::INFINITY;
41+
ONE == f32::NEG_INFINITY;
4242

4343
// no errors, but will warn clippy::float_cmp if '#![allow(float_cmp)]' above is removed
4444
let w = 1.1;

tests/ui/if_same_then_else.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn if_same_then_else() {
7878
let _ = if true { 0.0 } else { -0.0 };
7979

8080
// Different NaNs
81-
let _ = if true { 0.0 / 0.0 } else { std::f32::NAN };
81+
let _ = if true { 0.0 / 0.0 } else { f32::NAN };
8282

8383
if true {
8484
foo();

tests/ui/if_same_then_else2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ fn if_same_then_else2() -> Result<&'static str, ()> {
8787

8888
// Same NaNs
8989
let _ = if true {
90-
std::f32::NAN
90+
f32::NAN
9191
} else {
9292
//~ ERROR same body as `if` block
93-
std::f32::NAN
93+
f32::NAN
9494
};
9595

9696
if true {

tests/ui/if_same_then_else2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ error: this `if` has identical blocks
6969
LL | } else {
7070
| ____________^
7171
LL | | //~ ERROR same body as `if` block
72-
LL | | std::f32::NAN
72+
LL | | f32::NAN
7373
LL | | };
7474
| |_____^
7575
|
@@ -78,7 +78,7 @@ note: same as this
7878
|
7979
LL | let _ = if true {
8080
| _____________________^
81-
LL | | std::f32::NAN
81+
LL | | f32::NAN
8282
LL | | } else {
8383
| |_____^
8484

0 commit comments

Comments
 (0)