Merge commit '37f4fbb929' into clippy-subtree-update
This commit is contained in:
parent
6d674685ae
commit
4e6851e50b
291 changed files with 4890 additions and 5205 deletions
|
|
@ -16,6 +16,7 @@ use rustc_session::impl_lint_pass;
|
|||
use rustc_span::symbol::{kw, Ident};
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_trait_selection::error_reporting::traits::suggestions::ReturnsVisitor;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
|
|
@ -276,7 +277,6 @@ struct CheckCalls<'a, 'tcx> {
|
|||
cx: &'a LateContext<'tcx>,
|
||||
map: Map<'tcx>,
|
||||
implemented_ty_id: DefId,
|
||||
found_default_call: bool,
|
||||
method_span: Span,
|
||||
}
|
||||
|
||||
|
|
@ -285,16 +285,14 @@ where
|
|||
'tcx: 'a,
|
||||
{
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
type Result = ControlFlow<()>;
|
||||
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
self.map
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
|
||||
if self.found_default_call {
|
||||
return;
|
||||
}
|
||||
walk_expr(self, expr);
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) -> ControlFlow<()> {
|
||||
walk_expr(self, expr)?;
|
||||
|
||||
if let ExprKind::Call(f, _) = expr.kind
|
||||
&& let ExprKind::Path(qpath) = f.kind
|
||||
|
|
@ -303,9 +301,10 @@ where
|
|||
&& let Some(trait_def_id) = self.cx.tcx.trait_of_item(method_def_id)
|
||||
&& self.cx.tcx.is_diagnostic_item(sym::Default, trait_def_id)
|
||||
{
|
||||
self.found_default_call = true;
|
||||
span_error(self.cx, self.method_span, expr);
|
||||
return ControlFlow::Break(());
|
||||
}
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -383,7 +382,6 @@ impl UnconditionalRecursion {
|
|||
cx,
|
||||
map: cx.tcx.hir(),
|
||||
implemented_ty_id,
|
||||
found_default_call: false,
|
||||
method_span,
|
||||
};
|
||||
walk_body(&mut c, body);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue