about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAliƩnore Bouttefeux <alienore.bouttefeux@gmail.com>2021-04-04 13:03:05 +0200
committerAliƩnore Bouttefeux <alienore.bouttefeux@gmail.com>2021-04-04 13:03:05 +0200
commit2f81e4e34f96ee674072cbd1ffe55b68da5cc425 (patch)
tree50c4e8adca201a23e8999a92ddc06c4f285530d0
parent984ab98712d405e3a17a862b2bce6dd88a0e339b (diff)
downloadrust-2f81e4e34f96ee674072cbd1ffe55b68da5cc425.tar.gz
rust-2f81e4e34f96ee674072cbd1ffe55b68da5cc425.zip
modification not working: fixing
-rw-r--r--clippy_lints/src/doc.rs5
-rw-r--r--clippy_utils/src/lib.rs2
-rw-r--r--clippy_utils/src/paths.rs1
3 files changed, 5 insertions, 3 deletions
diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs
index 69800f9d331..ea4f4fda0dd 100644
--- a/clippy_lints/src/doc.rs
+++ b/clippy_lints/src/doc.rs
@@ -721,6 +721,11 @@ impl<'a, 'tcx> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
             }
         }
 
+        // check for `assert_eq` or `assert_ne`
+        if is_expn_of(expr.span, "assert_eq").is_some() || is_expn_of(expr.span, "assert_ne").is_some() {
+            self.panic_span = Some(expr.span);
+        }
+
         // check for `unwrap`
         if let Some(arglists) = method_chain_args(expr, &["unwrap"]) {
             let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs
index aade3409ebe..d6364625e70 100644
--- a/clippy_utils/src/lib.rs
+++ b/clippy_utils/src/lib.rs
@@ -1172,7 +1172,6 @@ pub fn match_panic_call<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> O
         .or_else(|| match_function_call(cx, expr, &paths::PANICKING_PANIC))
         .or_else(|| match_function_call(cx, expr, &paths::PANICKING_PANIC_FMT))
         .or_else(|| match_function_call(cx, expr, &paths::PANICKING_PANIC_STR))
-        .or_else(|| match_function_call(cx, expr, &paths::PANICKING_ASSERT_FAILED_INNER))
 }
 
 pub fn match_panic_def_id(cx: &LateContext<'_>, did: DefId) -> bool {
@@ -1182,7 +1181,6 @@ pub fn match_panic_def_id(cx: &LateContext<'_>, did: DefId) -> bool {
         || match_def_path(cx, did, &paths::PANICKING_PANIC)
         || match_def_path(cx, did, &paths::PANICKING_PANIC_FMT)
         || match_def_path(cx, did, &paths::PANICKING_PANIC_STR)
-        || match_def_path(cx, did, &paths::PANICKING_ASSERT_FAILED_INNER)
 }
 
 /// Returns the list of condition expressions and the list of blocks in a
diff --git a/clippy_utils/src/paths.rs b/clippy_utils/src/paths.rs
index 287da83babd..7c83a9fe4e2 100644
--- a/clippy_utils/src/paths.rs
+++ b/clippy_utils/src/paths.rs
@@ -86,7 +86,6 @@ pub const OPTION_SOME: [&str; 4] = ["core", "option", "Option", "Some"];
 pub const ORD: [&str; 3] = ["core", "cmp", "Ord"];
 pub const OS_STRING_AS_OS_STR: [&str; 5] = ["std", "ffi", "os_str", "OsString", "as_os_str"];
 pub const OS_STR_TO_OS_STRING: [&str; 5] = ["std", "ffi", "os_str", "OsStr", "to_os_string"];
-pub(super) const PANICKING_ASSERT_FAILED_INNER: [&str; 3] = ["core", "panicking", "assert_failed_inner"];
 pub(super) const PANICKING_PANIC: [&str; 3] = ["core", "panicking", "panic"];
 pub(super) const PANICKING_PANIC_FMT: [&str; 3] = ["core", "panicking", "panic_fmt"];
 pub(super) const PANICKING_PANIC_STR: [&str; 3] = ["core", "panicking", "panic_str"];