diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index dbadce619..b5acafac1 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -465,8 +465,13 @@ fn check_to_owned(cx: &LateContext, expr: &Expr, other: &Expr) { return; } - span_lint_and_then(cx, CMP_OWNED, expr.span, "this creates an owned instance just for comparison", |db| { - // this is as good as our recursion check can get, we can't prove that the current function is called by + span_lint_and_then(cx, + CMP_OWNED, + expr.span, + "this creates an owned instance just for comparison", + |db| { + // this is as good as our recursion check can get, we can't prove that the current function is + // called by // PartialEq::eq, but we can at least ensure that this code is not part of it let parent_fn = cx.tcx.hir.get_parent(expr.id); let parent_impl = cx.tcx.hir.get_parent(parent_fn); @@ -474,7 +479,8 @@ fn check_to_owned(cx: &LateContext, expr: &Expr, other: &Expr) { if let map::NodeItem(item) = cx.tcx.hir.get(parent_impl) { if let ItemImpl(.., Some(ref trait_ref), _, _) = item.node { if trait_ref.path.def.def_id() == partial_eq_trait_id { - // we are implementing PartialEq, don't suggest not doing `to_owned`, otherwise we go into recursion + // we are implementing PartialEq, don't suggest not doing `to_owned`, otherwise we go into + // recursion db.span_label(expr.span, "try calling implementing the comparison without allocating"); return; } diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 7254862a3..bdedd5a93 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -716,7 +716,7 @@ impl<'a, 'tcx> TypeComplexityPass { } /// Walks a type and assigns a complexity score to it. -struct TypeComplexityVisitor{ +struct TypeComplexityVisitor { /// total complexity score of the type score: u64, /// current nesting level diff --git a/clippy_lints/src/utils/conf.rs b/clippy_lints/src/utils/conf.rs index 772f7f6ad..0e6f88563 100644 --- a/clippy_lints/src/utils/conf.rs +++ b/clippy_lints/src/utils/conf.rs @@ -218,7 +218,7 @@ pub fn read(path: Option<&path::Path>) -> (Conf, Vec) { let path = if let Some(path) = path { path } else { - return default(Vec::new()) + return default(Vec::new()); }; let file = match fs::File::open(path) { @@ -226,7 +226,7 @@ pub fn read(path: Option<&path::Path>) -> (Conf, Vec) { let mut buf = String::new(); if let Err(err) = file.read_to_string(&mut buf) { - return default(vec![err.into()]) + return default(vec![err.into()]); } buf