mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
fix todo item check, remove unimplemented
This commit is contained in:
parent
61a2f972b3
commit
1317378b9e
3 changed files with 13 additions and 4 deletions
|
@ -7,7 +7,7 @@ use clippy_utils::source::snippet;
|
|||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Block, Destination, Expr, ExprKind, HirId, InlineAsmOperand, Pat, Stmt, StmtKind};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{sym, Span};
|
||||
use std::iter::{once, Iterator};
|
||||
|
||||
pub(super) fn check<'tcx>(
|
||||
|
@ -273,7 +273,7 @@ fn never_loop_expr<'tcx>(
|
|||
});
|
||||
if let NeverLoopResult::Diverging = result &&
|
||||
let Some(macro_call) = root_macro_call_first_node(cx, expr) &&
|
||||
let "todo" | "unimplemented" = cx.tcx.item_name(macro_call.def_id).as_str()
|
||||
let Some(sym::todo_macro) = cx.tcx.get_diagnostic_name(macro_call.def_id)
|
||||
{
|
||||
// We return MayContinueMainLoop here because we treat `todo!()` and
|
||||
// `unimplemented!()` macros as potentially containing any code,
|
||||
|
|
|
@ -391,7 +391,7 @@ pub fn test32() {
|
|||
panic!("oh no");
|
||||
}
|
||||
loop {
|
||||
// no error
|
||||
//~^ ERROR: this loop never actually loops
|
||||
unimplemented!("not yet");
|
||||
}
|
||||
loop {
|
||||
|
|
|
@ -170,5 +170,14 @@ LL | | panic!("oh no");
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
error: this loop never actually loops
|
||||
--> $DIR/never_loop.rs:393:5
|
||||
|
|
||||
LL | / loop {
|
||||
LL | |
|
||||
LL | | unimplemented!("not yet");
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
||||
error: aborting due to 16 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue