forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#104144 - TaKO8Ki:suggest-removing-unnecessa…
…ry-dot, r=fee1-dead Suggest removing unnecessary `.` to use a floating point literal Fixes a part of rust-lang#101883
- Loading branch information
Showing
4 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fn main() { | ||
let _: f64 = 0..10; //~ ERROR mismatched types | ||
let _: f64 = 1..; //~ ERROR mismatched types | ||
let _: f64 = ..10; //~ ERROR mismatched types | ||
let _: f64 = std::ops::Range { start: 0, end: 1 }; //~ ERROR mismatched types | ||
} |
59 changes: 59 additions & 0 deletions
59
src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/unnecessary_dot_for_floating_point_literal.rs:2:18 | ||
| | ||
LL | let _: f64 = 0..10; | ||
| --- ^^^^^ expected `f64`, found struct `std::ops::Range` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected type `f64` | ||
found struct `std::ops::Range<{integer}>` | ||
help: remove the unnecessary `.` operator for a floating point literal | ||
| | ||
LL | let _: f64 = 0.10; | ||
| ~ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/unnecessary_dot_for_floating_point_literal.rs:3:18 | ||
| | ||
LL | let _: f64 = 1..; | ||
| --- ^^^ expected `f64`, found struct `RangeFrom` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected type `f64` | ||
found struct `RangeFrom<{integer}>` | ||
help: remove the unnecessary `.` operator for a floating point literal | ||
| | ||
LL | let _: f64 = 1.; | ||
| ~ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/unnecessary_dot_for_floating_point_literal.rs:4:18 | ||
| | ||
LL | let _: f64 = ..10; | ||
| --- ^^^^ expected `f64`, found struct `RangeTo` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected type `f64` | ||
found struct `RangeTo<{integer}>` | ||
help: remove the unnecessary `.` operator and add an integer part for a floating point literal | ||
| | ||
LL | let _: f64 = 0.10; | ||
| ~~ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18 | ||
| | ||
LL | let _: f64 = std::ops::Range { start: 0, end: 1 }; | ||
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found struct `std::ops::Range` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected type `f64` | ||
found struct `std::ops::Range<{integer}>` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |