Add UI test for primitive_method_to_numeric_cast
This commit is contained in:
parent
be40534457
commit
c680419425
3 changed files with 25 additions and 0 deletions
5
tests/ui/primitive_method_to_numeric_cast.fixed
Normal file
5
tests/ui/primitive_method_to_numeric_cast.fixed
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#![warn(clippy::primitive_method_to_numeric_cast)]
|
||||
|
||||
fn main() {
|
||||
let _ = u16::MAX as usize; //~ primitive_method_to_numeric_cast
|
||||
}
|
||||
5
tests/ui/primitive_method_to_numeric_cast.rs
Normal file
5
tests/ui/primitive_method_to_numeric_cast.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#![warn(clippy::primitive_method_to_numeric_cast)]
|
||||
|
||||
fn main() {
|
||||
let _ = u16::max as usize; //~ primitive_method_to_numeric_cast
|
||||
}
|
||||
15
tests/ui/primitive_method_to_numeric_cast.stderr
Normal file
15
tests/ui/primitive_method_to_numeric_cast.stderr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
error: casting function pointer `u16::max` to `usize`
|
||||
--> tests/ui/primitive_method_to_numeric_cast.rs:4:13
|
||||
|
|
||||
LL | let _ = u16::max as usize;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::primitive-method-to-numeric-cast` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::primitive_method_to_numeric_cast)]`
|
||||
help: did you mean to use the associated constant?
|
||||
|
|
||||
LL | let _ = u16::MAX as usize;
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue