about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMax Baumann <max@bmn.dev>2022-03-18 01:04:33 +0100
committerMax Baumann <max@bmn.dev>2022-03-18 01:04:33 +0100
commit05e05eaed7f512bf2a1f7f236fc4b484d4a52aa5 (patch)
treed60f4b526d2570557c1e74194a0b9091b032eb3c
parent44c62c9aa23e0d8401d9bdc1e2df913cfd035c7e (diff)
downloadrust-05e05eaed7f512bf2a1f7f236fc4b484d4a52aa5.tar.gz
rust-05e05eaed7f512bf2a1f7f236fc4b484d4a52aa5.zip
refactor: rename lint to or_then_unwrap
-rw-r--r--CHANGELOG.md2
-rw-r--r--clippy_lints/src/lib.register_all.rs2
-rw-r--r--clippy_lints/src/lib.register_complexity.rs2
-rw-r--r--clippy_lints/src/lib.register_lints.rs2
-rw-r--r--clippy_lints/src/lib.rs4
-rw-r--r--clippy_lints/src/or_then_unwrap.rs (renamed from clippy_lints/src/use_unwrap_or.rs)8
-rw-r--r--tests/ui/or_then_unwrap.rs (renamed from tests/ui/use_unwrap_or.rs)2
-rw-r--r--tests/ui/or_then_unwrap.stderr (renamed from tests/ui/use_unwrap_or.stderr)6
8 files changed, 14 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9475c674983..b45be38bf4d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3538,7 +3538,7 @@ Released 2018-09-13
 [`upper_case_acronyms`]: https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
 [`use_debug`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_debug
 [`use_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_self
-[`use_unwrap_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_unwrap_or
+[`or_then_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#or_then_unwrap
 [`used_underscore_binding`]: https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_binding
 [`useless_asref`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_asref
 [`useless_attribute`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute
diff --git a/clippy_lints/src/lib.register_all.rs b/clippy_lints/src/lib.register_all.rs
index a42f4cb6d70..5c3e352d09f 100644
--- a/clippy_lints/src/lib.register_all.rs
+++ b/clippy_lints/src/lib.register_all.rs
@@ -310,7 +310,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
     LintId::of(unwrap::PANICKING_UNWRAP),
     LintId::of(unwrap::UNNECESSARY_UNWRAP),
     LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS),
-    LintId::of(use_unwrap_or::USE_UNWRAP_OR),
+    LintId::of(or_then_unwrap::OR_THEN_UNWRAP),
     LintId::of(useless_conversion::USELESS_CONVERSION),
     LintId::of(vec::USELESS_VEC),
     LintId::of(vec_init_then_push::VEC_INIT_THEN_PUSH),
diff --git a/clippy_lints/src/lib.register_complexity.rs b/clippy_lints/src/lib.register_complexity.rs
index 94ff53c2a60..45ad1520396 100644
--- a/clippy_lints/src/lib.register_complexity.rs
+++ b/clippy_lints/src/lib.register_complexity.rs
@@ -94,7 +94,7 @@ store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec!
     LintId::of(unit_types::UNIT_ARG),
     LintId::of(unnecessary_sort_by::UNNECESSARY_SORT_BY),
     LintId::of(unwrap::UNNECESSARY_UNWRAP),
-    LintId::of(use_unwrap_or::USE_UNWRAP_OR),
+    LintId::of(or_then_unwrap::OR_THEN_UNWRAP),
     LintId::of(useless_conversion::USELESS_CONVERSION),
     LintId::of(zero_div_zero::ZERO_DIVIDED_BY_ZERO),
 ])
diff --git a/clippy_lints/src/lib.register_lints.rs b/clippy_lints/src/lib.register_lints.rs
index d1e13647e7e..aad0c8735ee 100644
--- a/clippy_lints/src/lib.register_lints.rs
+++ b/clippy_lints/src/lib.register_lints.rs
@@ -528,7 +528,7 @@ store.register_lints(&[
     unwrap_in_result::UNWRAP_IN_RESULT,
     upper_case_acronyms::UPPER_CASE_ACRONYMS,
     use_self::USE_SELF,
-    use_unwrap_or::USE_UNWRAP_OR,
+    or_then_unwrap::OR_THEN_UNWRAP,
     useless_conversion::USELESS_CONVERSION,
     vec::USELESS_VEC,
     vec_init_then_push::VEC_INIT_THEN_PUSH,
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index 9c9e9643bc9..fdab58935ef 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -322,6 +322,7 @@ mod only_used_in_recursion;
 mod open_options;
 mod option_env_unwrap;
 mod option_if_let_else;
+mod or_then_unwrap;
 mod overflow_check_conditional;
 mod panic_in_result_fn;
 mod panic_unimplemented;
@@ -394,7 +395,6 @@ mod unwrap;
 mod unwrap_in_result;
 mod upper_case_acronyms;
 mod use_self;
-mod use_unwrap_or;
 mod useless_conversion;
 mod vec;
 mod vec_init_then_push;
@@ -867,7 +867,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
             ignore_publish: cargo_ignore_publish,
         })
     });
-    store.register_late_pass(|| Box::new(use_unwrap_or::UseUnwrapOr));
+    store.register_late_pass(|| Box::new(or_then_unwrap::OrThenUnwrap));
     // add lints here, do not remove this comment, it's used in `new_lint`
 }
 
diff --git a/clippy_lints/src/use_unwrap_or.rs b/clippy_lints/src/or_then_unwrap.rs
index 3e40014f50f..d467fbdfe02 100644
--- a/clippy_lints/src/use_unwrap_or.rs
+++ b/clippy_lints/src/or_then_unwrap.rs
@@ -37,13 +37,13 @@ declare_clippy_lint! {
     /// let value = option.unwrap_or(fallback);
     /// ```
     #[clippy::version = "1.61.0"]
-    pub USE_UNWRAP_OR,
+    pub OR_THEN_UNWRAP,
     complexity,
     "checks for `.or(…).unwrap()` calls to Options and Results."
 }
-declare_lint_pass!(UseUnwrapOr => [USE_UNWRAP_OR]);
+declare_lint_pass!(OrThenUnwrap => [OR_THEN_UNWRAP]);
 
-impl<'tcx> LateLintPass<'tcx> for UseUnwrapOr {
+impl<'tcx> LateLintPass<'tcx> for OrThenUnwrap {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         // look for x.or().unwrap()
         if_chain! {
@@ -73,7 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for UseUnwrapOr {
 
                 span_lint_and_help(
                     cx,
-                    USE_UNWRAP_OR,
+                    OR_THEN_UNWRAP,
                     or_span.to(*unwrap_span),
                     title,
                     None,
diff --git a/tests/ui/use_unwrap_or.rs b/tests/ui/or_then_unwrap.rs
index dd55b33739d..cbc3c387da0 100644
--- a/tests/ui/use_unwrap_or.rs
+++ b/tests/ui/or_then_unwrap.rs
@@ -1,4 +1,4 @@
-#![warn(clippy::use_unwrap_or)]
+#![warn(clippy::or_then_unwrap)]
 #![allow(clippy::map_identity)]
 
 struct SomeStruct {}
diff --git a/tests/ui/use_unwrap_or.stderr b/tests/ui/or_then_unwrap.stderr
index 796778a293d..fdd718b3580 100644
--- a/tests/ui/use_unwrap_or.stderr
+++ b/tests/ui/or_then_unwrap.stderr
@@ -1,14 +1,14 @@
 error: .or(Some(…)).unwrap() found
-  --> $DIR/use_unwrap_or.rs:22:20
+  --> $DIR/or_then_unwrap.rs:22:20
    |
 LL |     let _ = option.or(Some("fallback")).unwrap(); // should trigger lint
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: `-D clippy::use-unwrap-or` implied by `-D warnings`
+   = note: `-D clippy::or-then-unwrap` implied by `-D warnings`
    = help: use `unwrap_or()` instead
 
 error: .or(Ok(…)).unwrap() found
-  --> $DIR/use_unwrap_or.rs:25:20
+  --> $DIR/or_then_unwrap.rs:25:20
    |
 LL |     let _ = result.or::<&str>(Ok("fallback")).unwrap(); // should trigger lint
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^