-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #10423 - Alexendoo:array-size-threshold, r=flip1995
Fix array-size-threshold config deserialization error changelog: Fix error when providing an `array-size-threshold` in `clippy.toml` Not entirely sure why it doesn't want to deserialize a u128, but converting it after the fact is an easy enough fix Fixes #10422
- Loading branch information
Showing
10 changed files
with
53 additions
and
17 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
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
10 changes: 10 additions & 0 deletions
10
tests/ui-toml/array_size_threshold/array_size_threshold.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,10 @@ | ||
#![allow(unused)] | ||
#![warn(clippy::large_const_arrays, clippy::large_stack_arrays)] | ||
|
||
const ABOVE: [u8; 11] = [0; 11]; | ||
const BELOW: [u8; 10] = [0; 10]; | ||
|
||
fn main() { | ||
let above = [0u8; 11]; | ||
let below = [0u8; 10]; | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/ui-toml/array_size_threshold/array_size_threshold.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,29 @@ | ||
error: large array defined as const | ||
--> $DIR/array_size_threshold.rs:4:1 | ||
| | ||
LL | const ABOVE: [u8; 11] = [0; 11]; | ||
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| help: make this a static item: `static` | ||
| | ||
= note: `-D clippy::large-const-arrays` implied by `-D warnings` | ||
|
||
error: allocating a local array larger than 10 bytes | ||
--> $DIR/array_size_threshold.rs:4:25 | ||
| | ||
LL | const ABOVE: [u8; 11] = [0; 11]; | ||
| ^^^^^^^ | ||
| | ||
= help: consider allocating on the heap with `vec![0; 11].into_boxed_slice()` | ||
= note: `-D clippy::large-stack-arrays` implied by `-D warnings` | ||
|
||
error: allocating a local array larger than 10 bytes | ||
--> $DIR/array_size_threshold.rs:8:17 | ||
| | ||
LL | let above = [0u8; 11]; | ||
| ^^^^^^^^^ | ||
| | ||
= help: consider allocating on the heap with `vec![0u8; 11].into_boxed_slice()` | ||
|
||
error: aborting due to 3 previous errors | ||
|
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 @@ | ||
array-size-threshold = 10 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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