summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui-toml/decimal_literal_representation
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /src/tools/clippy/tests/ui-toml/decimal_literal_representation
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui-toml/decimal_literal_representation')
-rw-r--r--src/tools/clippy/tests/ui-toml/decimal_literal_representation/clippy.toml1
-rw-r--r--src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.fixed6
-rw-r--r--src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.rs6
-rw-r--r--src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr11
4 files changed, 24 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui-toml/decimal_literal_representation/clippy.toml b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/clippy.toml
new file mode 100644
index 000000000..74fc5d249
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/clippy.toml
@@ -0,0 +1 @@
+literal-representation-threshold = 0xFFFFFF
diff --git a/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.fixed b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.fixed
new file mode 100644
index 000000000..750f3be84
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.fixed
@@ -0,0 +1,6 @@
+#![warn(clippy::decimal_literal_representation)]
+fn main() {
+ let _ = 8388608;
+ let _ = 0x00FF_FFFF;
+ //~^ ERROR: integer literal has a better hexadecimal representation
+}
diff --git a/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.rs b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.rs
new file mode 100644
index 000000000..26b3354d1
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.rs
@@ -0,0 +1,6 @@
+#![warn(clippy::decimal_literal_representation)]
+fn main() {
+ let _ = 8388608;
+ let _ = 16777215;
+ //~^ ERROR: integer literal has a better hexadecimal representation
+}
diff --git a/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr
new file mode 100644
index 000000000..6f817a3fd
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/decimal_literal_representation/decimal_literal_representation.stderr
@@ -0,0 +1,11 @@
+error: integer literal has a better hexadecimal representation
+ --> $DIR/decimal_literal_representation.rs:4:13
+ |
+LL | let _ = 16777215;
+ | ^^^^^^^^ help: consider: `0x00FF_FFFF`
+ |
+ = note: `-D clippy::decimal-literal-representation` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::decimal_literal_representation)]`
+
+error: aborting due to previous error
+