summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive
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/upper_case_acronyms_aggressive
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/upper_case_acronyms_aggressive')
-rw-r--r--src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.fixed44
-rw-r--r--src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr1
2 files changed, 45 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.fixed b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.fixed
new file mode 100644
index 000000000..afb889f15
--- /dev/null
+++ b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.fixed
@@ -0,0 +1,44 @@
+#![warn(clippy::upper_case_acronyms)]
+
+struct HttpResponse; // not linted by default, but with cfg option
+
+struct CString; // not linted
+
+enum Flags {
+ Ns, // not linted
+ Cwr,
+ Ece,
+ Urg,
+ Ack,
+ Psh,
+ Rst,
+ Syn,
+ Fin,
+}
+
+// linted with cfg option, beware that lint suggests `GccllvmSomething` instead of
+// `GccLlvmSomething`
+struct GccllvmSomething;
+
+// don't warn on public items
+pub struct MIXEDCapital;
+
+pub struct FULLCAPITAL;
+
+// enum variants should not be linted if the num is pub
+pub enum ParseError<T> {
+ FULLCAPITAL(u8),
+ MIXEDCapital(String),
+ Utf8(std::string::FromUtf8Error),
+ Parse(T, String),
+}
+
+// private, do lint here
+enum ParseErrorPrivate<T> {
+ Wasd(u8),
+ WasdMixed(String),
+ Utf8(std::string::FromUtf8Error),
+ Parse(T, String),
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr
index 02f29bbef..3fad561b1 100644
--- a/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr
+++ b/src/tools/clippy/tests/ui-toml/upper_case_acronyms_aggressive/upper_case_acronyms.stderr
@@ -5,6 +5,7 @@ LL | struct HTTPResponse; // not linted by default, but with cfg option
| ^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `HttpResponse`
|
= note: `-D clippy::upper-case-acronyms` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::upper_case_acronyms)]`
error: name `NS` contains a capitalized acronym
--> $DIR/upper_case_acronyms.rs:8:5