Skip to content

Commit

Permalink
Add run-rustfix marker
Browse files Browse the repository at this point in the history
  • Loading branch information
timvisee committed Apr 17, 2023
1 parent 503fd56 commit 54a0a52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions clippy_lints/src/manual_slice_size_calculation.rs
@@ -1,3 +1,4 @@
// run-rustfix
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet_with_context;
use clippy_utils::{expr_or_init, in_constant};
Expand Down
1 change: 1 addition & 0 deletions tests/ui/manual_slice_size_calculation.rs
@@ -1,3 +1,4 @@
// run-rustfix
#![allow(unused)]
#![warn(clippy::manual_slice_size_calculation)]

Expand Down
12 changes: 6 additions & 6 deletions tests/ui/manual_slice_size_calculation.stderr
@@ -1,37 +1,37 @@
error: manual slice size calculation
--> $DIR/manual_slice_size_calculation.rs:11:13
--> $DIR/manual_slice_size_calculation.rs:12:13
|
LL | let _ = s_i32.len() * size_of::<i32>(); // WARNING
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)`
|
= note: `-D clippy::manual-slice-size-calculation` implied by `-D warnings`

error: manual slice size calculation
--> $DIR/manual_slice_size_calculation.rs:12:13
--> $DIR/manual_slice_size_calculation.rs:13:13
|
LL | let _ = size_of::<i32>() * s_i32.len(); // WARNING
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)`

error: manual slice size calculation
--> $DIR/manual_slice_size_calculation.rs:13:13
--> $DIR/manual_slice_size_calculation.rs:14:13
|
LL | let _ = size_of::<i32>() * s_i32.len() * 5; // WARNING
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)`

error: manual slice size calculation
--> $DIR/manual_slice_size_calculation.rs:17:13
--> $DIR/manual_slice_size_calculation.rs:18:13
|
LL | let _ = len * size_of::<i32>(); // WARNING
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)`

error: manual slice size calculation
--> $DIR/manual_slice_size_calculation.rs:18:13
--> $DIR/manual_slice_size_calculation.rs:19:13
|
LL | let _ = s_i32.len() * size; // WARNING
| ^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)`

error: manual slice size calculation
--> $DIR/manual_slice_size_calculation.rs:19:13
--> $DIR/manual_slice_size_calculation.rs:20:13
|
LL | let _ = len * size; // WARNING
| ^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)`
Expand Down

0 comments on commit 54a0a52

Please sign in to comment.