Run rustfmt

This commit is contained in:
Oliver Schneider 2017-05-12 12:09:52 +02:00
parent 064878a13f
commit dfc7d2afd4
3 changed files with 12 additions and 6 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -218,7 +218,7 @@ pub fn read(path: Option<&path::Path>) -> (Conf, Vec<Error>) {
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<Error>) {
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