mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-03 17:35:28 +03:00
Fix false-positive debug_assert in panic
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for PanicUnimplemented {
|
||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
if match_panic_call(cx, expr).is_some() {
|
||||
if match_panic_call(cx, expr).is_some() && is_expn_of(expr.span, "debug_assert").is_none() {
|
||||
let span = get_outer_span(expr);
|
||||
if is_expn_of(expr.span, "unimplemented").is_some() {
|
||||
span_lint(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![warn(clippy::unimplemented, clippy::unreachable, clippy::todo, clippy::panic)]
|
||||
#![allow(clippy::assertions_on_constants)]
|
||||
#![allow(clippy::assertions_on_constants, clippy::eq_op)]
|
||||
|
||||
extern crate core;
|
||||
|
||||
@@ -43,6 +43,18 @@ fn core_versions() {
|
||||
unreachable!();
|
||||
}
|
||||
|
||||
fn debug_assert() {
|
||||
debug_assert!(true);
|
||||
debug_assert_eq!(true, true);
|
||||
debug_assert_ne!(true, false);
|
||||
}
|
||||
|
||||
fn debug_assert_msg() {
|
||||
debug_assert!(true, "test");
|
||||
debug_assert_eq!(true, true, "test");
|
||||
debug_assert_ne!(true, false, "test");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
panic();
|
||||
todo();
|
||||
|
||||
Reference in New Issue
Block a user