diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui-toml/excessive_width/clippy.toml | 3 | ||||
| -rw-r--r-- | tests/ui-toml/excessive_width/excessive_width.rs | 26 | ||||
| -rw-r--r-- | tests/ui-toml/excessive_width/excessive_width.stderr | 24 | ||||
| -rw-r--r-- | tests/ui/excessive_width.rs | 44 | ||||
| -rw-r--r-- | tests/ui/excessive_width.stderr | 11 |
5 files changed, 108 insertions, 0 deletions
diff --git a/tests/ui-toml/excessive_width/clippy.toml b/tests/ui-toml/excessive_width/clippy.toml new file mode 100644 index 00000000000..1824c8a3127 --- /dev/null +++ b/tests/ui-toml/excessive_width/clippy.toml @@ -0,0 +1,3 @@ +excessive-width-threshold = 20 +excessive-width-ignore-indentation = false +excessive-indentation-threshold = 3 diff --git a/tests/ui-toml/excessive_width/excessive_width.rs b/tests/ui-toml/excessive_width/excessive_width.rs new file mode 100644 index 00000000000..261b937e72e --- /dev/null +++ b/tests/ui-toml/excessive_width/excessive_width.rs @@ -0,0 +1,26 @@ +#![allow(unused)] +#![allow(clippy::identity_op)] +#![allow(clippy::no_effect)] +#![warn(clippy::excessive_width)] + +static mut C: u32 = 2u32; + +#[rustfmt::skip] +fn main() { + let x = 2 * unsafe { C }; + + { + { + // this too, even though it's only 15 characters! + (); + } + } + + { + { + { + println!("this will now emit a warning, how neat!") + } + } + } +} diff --git a/tests/ui-toml/excessive_width/excessive_width.stderr b/tests/ui-toml/excessive_width/excessive_width.stderr new file mode 100644 index 00000000000..00dce391be0 --- /dev/null +++ b/tests/ui-toml/excessive_width/excessive_width.stderr @@ -0,0 +1,24 @@ +error: this line is too long + --> $DIR/excessive_width.rs:10:5 + | +LL | let x = 2 * unsafe { C }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider running rustfmt or refactoring this + = note: `-D clippy::excessive-width` implied by `-D warnings` + +error: this line is too long + --> $DIR/excessive_width.rs:12:5 + | +LL | / { +LL | | { +LL | | // this too, even though it's only 15 characters! +LL | | (); +LL | | } +LL | | } + | |_____^ + | + = help: consider running rustfmt or refactoring this + +error: aborting due to 2 previous errors + diff --git a/tests/ui/excessive_width.rs b/tests/ui/excessive_width.rs new file mode 100644 index 00000000000..218950f9684 --- /dev/null +++ b/tests/ui/excessive_width.rs @@ -0,0 +1,44 @@ +#![allow(unused)] +#![allow(clippy::identity_op)] +#![warn(clippy::excessive_width)] + +#[rustfmt::skip] +fn main() { + let x = 1; + + let really_long_binding_name_because_this_needs_to_be_over_90_characters_long = 1usize * 200 / 2 * 500 / 1; + + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + println!("highly indented lines do not cause a warning (by default)!") + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/tests/ui/excessive_width.stderr b/tests/ui/excessive_width.stderr new file mode 100644 index 00000000000..707a3796b56 --- /dev/null +++ b/tests/ui/excessive_width.stderr @@ -0,0 +1,11 @@ +error: this line is too long + --> $DIR/excessive_width.rs:9:5 + | +LL | let really_long_binding_name_because_this_needs_to_be_over_90_characters_long = 1usize * 200 / 2 * 500 / 1; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider running rustfmt or refactoring this + = note: `-D clippy::excessive-width` implied by `-D warnings` + +error: aborting due to previous error + |
