]> git.lizzy.rs Git - rust.git/commitdiff
Rerun rustfmt
authorManish Goregaokar <manishsmail@gmail.com>
Wed, 4 Jan 2017 23:53:16 +0000 (15:53 -0800)
committerManish Goregaokar <manishsmail@gmail.com>
Wed, 4 Jan 2017 23:53:16 +0000 (15:53 -0800)
clippy_lints/src/consts.rs
clippy_lints/src/enum_clike.rs
clippy_lints/src/functions.rs
clippy_lints/src/methods.rs
clippy_lints/src/mut_reference.rs
clippy_lints/src/utils/hir.rs
clippy_lints/src/utils/inspector.rs
clippy_lints/src/utils/mod.rs

index 03eb0fd0540db792c68a3b33be57831c23740313..1f31cb0b2ecd2925d165571889e2712d809b9b88 100644 (file)
@@ -262,7 +262,9 @@ fn expr(&mut self, e: &Expr) -> Option<Constant> {
             ExprTup(ref tup) => self.multi(tup).map(Constant::Tuple),
             ExprRepeat(ref value, number_id) => {
                 if let Some(lcx) = self.lcx {
-                    self.binop_apply(value, &lcx.tcx.map.body(number_id).value, |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))
+                    self.binop_apply(value,
+                                     &lcx.tcx.map.body(number_id).value,
+                                     |v, n| Some(Constant::Repeat(Box::new(v), n.as_u64() as usize)))
                 } else {
                     None
                 }
index 5168b4abb9d77412f12ce737fc4ec20effcf45cf..896efb438458138a03f3a9bed8268566e0fdb9c6 100644 (file)
@@ -44,7 +44,10 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
                 let variant = &var.node;
                 if let Some(body_id) = variant.disr_expr {
                     use rustc_const_eval::*;
-                    let bad = match eval_const_expr_partial(cx.tcx, &cx.tcx.map.body(body_id).value, EvalHint::ExprTypeChecked, None) {
+                    let bad = match eval_const_expr_partial(cx.tcx,
+                                                            &cx.tcx.map.body(body_id).value,
+                                                            EvalHint::ExprTypeChecked,
+                                                            None) {
                         Ok(ConstVal::Integral(Usize(Us64(i)))) => i as u32 as u64 != i,
                         Ok(ConstVal::Integral(Isize(Is64(i)))) => i as i32 as i64 != i,
                         _ => false,
index 36d774b4f9f3c8ec20e052d7f7cffe27337c7d3f..2d85f2dd3cbf8afa2158238bccdffd5fb7bdb268 100644 (file)
@@ -141,9 +141,10 @@ fn check_raw_ptr(
     ) {
         let expr = &body.value;
         if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(nodeid) {
-            let raw_ptrs = iter_input_pats(decl, body).zip(decl.inputs.iter())
-                                                      .filter_map(|(arg, ty)| raw_ptr_arg(arg, ty))
-                                                      .collect::<HashSet<_>>();
+            let raw_ptrs = iter_input_pats(decl, body)
+                .zip(decl.inputs.iter())
+                .filter_map(|(arg, ty)| raw_ptr_arg(arg, ty))
+                .collect::<HashSet<_>>();
 
             if !raw_ptrs.is_empty() {
                 let mut v = DerefVisitor {
index 9f2cecebca1978150250ff171c940f988a40faba..8f1c6e4e9d1a852fdfbeb104c07cd639098ee72f 100644 (file)
@@ -751,8 +751,12 @@ fn check_general_case(
     ) {
         // don't lint for constant values
         // FIXME: can we `expect` here instead of match?
-        let promotable = cx.tcx.rvalue_promotable_to_static.borrow()
-                             .get(&arg.id).cloned().unwrap_or(true);
+        let promotable = cx.tcx
+            .rvalue_promotable_to_static
+            .borrow()
+            .get(&arg.id)
+            .cloned()
+            .unwrap_or(true);
         if promotable {
             return;
         }
@@ -1348,19 +1352,18 @@ enum SelfKind {
 
 impl SelfKind {
     fn matches(self, ty: &hir::Ty, arg: &hir::Arg, self_ty: &hir::Ty, allow_value_for_ref: bool) -> bool {
-        // Self types in the HIR are desugared to explicit self types. So it will always be `self: SomeType`,
+        // Self types in the HIR are desugared to explicit self types. So it will always be `self:
+        // SomeType`,
         // where SomeType can be `Self` or an explicit impl self type (e.g. `Foo` if the impl is on `Foo`)
         // Thus, we only need to test equality against the impl self type or if it is an explicit
         // `Self`. Furthermore, the only possible types for `self: ` are `&Self`, `Self`, `&mut Self`,
         // and `Box<Self>`, including the equivalent types with `Foo`.
-        let is_actually_self = |ty| {
-            is_self_ty(ty) || ty == self_ty
-        };
+        let is_actually_self = |ty| is_self_ty(ty) || ty == self_ty;
         if is_self(arg) {
-           match self {
+            match self {
                 SelfKind::Value => is_actually_self(ty),
                 SelfKind::Ref | SelfKind::RefMut if allow_value_for_ref => is_actually_self(ty),
-                SelfKind::Ref | SelfKind::RefMut=> {
+                SelfKind::Ref | SelfKind::RefMut => {
                     match ty.node {
                         hir::TyRptr(_, ref mt_ty) => {
                             let mutability_match = if self == SelfKind::Ref {
@@ -1370,10 +1373,10 @@ fn matches(self, ty: &hir::Ty, arg: &hir::Arg, self_ty: &hir::Ty, allow_value_fo
                             };
                             is_actually_self(&mt_ty.ty) && mutability_match
 
-                        }
-                        _ => false
+                        },
+                        _ => false,
                     }
-                }
+                },
                 _ => false,
             }
         } else {
index a181c33ebb961868ea09dda8d3ec199f69f1fe04..6e27358836bcb770616de45cd65afeb5c1ee8852 100644 (file)
@@ -42,7 +42,10 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
                     .expect("A function with an unknown type is called. If this happened, the compiler would have \
                              aborted the compilation long ago");
                 if let ExprPath(ref path) = fn_expr.node {
-                    check_arguments(cx, arguments, function_type, &print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)));
+                    check_arguments(cx,
+                                    arguments,
+                                    function_type,
+                                    &print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)));
                 }
             },
             ExprMethodCall(ref name, _, ref arguments) => {
index 454a0813507793f50576373cf60b7d483007d147..e330a662f97d5c025f301f5ef4d778aa92ad50a8 100644 (file)
@@ -112,7 +112,10 @@ pub fn eq_expr(&self, left: &Expr, right: &Expr) -> bool {
                 !self.ignore_fn && l_name.node == r_name.node && over(l_tys, r_tys, |l, r| self.eq_ty(l, r)) &&
                 self.eq_exprs(l_args, r_args)
             },
-            (&ExprRepeat(ref le, ll_id), &ExprRepeat(ref re, rl_id)) => self.eq_expr(le, re) && self.eq_expr(&self.cx.tcx.map.body(ll_id).value, &self.cx.tcx.map.body(rl_id).value),
+            (&ExprRepeat(ref le, ll_id), &ExprRepeat(ref re, rl_id)) => {
+                self.eq_expr(le, re) &&
+                self.eq_expr(&self.cx.tcx.map.body(ll_id).value, &self.cx.tcx.map.body(rl_id).value)
+            },
             (&ExprRet(ref l), &ExprRet(ref r)) => both(l, r, |l, r| self.eq_expr(l, r)),
             (&ExprPath(ref l), &ExprPath(ref r)) => self.eq_qpath(l, r),
             (&ExprStruct(ref l_path, ref lf, ref lo), &ExprStruct(ref r_path, ref rf, ref ro)) => {
@@ -183,7 +186,8 @@ fn eq_qpath(&self, left: &QPath, right: &QPath) -> bool {
     }
 
     fn eq_path(&self, left: &Path, right: &Path) -> bool {
-        left.is_global() == right.is_global() && over(&left.segments, &right.segments, |l, r| self.eq_path_segment(l, r))
+        left.is_global() == right.is_global() &&
+        over(&left.segments, &right.segments, |l, r| self.eq_path_segment(l, r))
     }
 
     fn eq_path_parameters(&self, left: &PathParameters, right: &PathParameters) -> bool {
@@ -211,7 +215,10 @@ fn eq_path_segment(&self, left: &PathSegment, right: &PathSegment) -> bool {
     fn eq_ty(&self, left: &Ty, right: &Ty) -> bool {
         match (&left.node, &right.node) {
             (&TySlice(ref l_vec), &TySlice(ref r_vec)) => self.eq_ty(l_vec, r_vec),
-            (&TyArray(ref lt, ll_id), &TyArray(ref rt, rl_id)) => self.eq_ty(lt, rt) && self.eq_expr(&self.cx.tcx.map.body(ll_id).value, &self.cx.tcx.map.body(rl_id).value),
+            (&TyArray(ref lt, ll_id), &TyArray(ref rt, rl_id)) => {
+                self.eq_ty(lt, rt) &&
+                self.eq_expr(&self.cx.tcx.map.body(ll_id).value, &self.cx.tcx.map.body(rl_id).value)
+            },
             (&TyPtr(ref l_mut), &TyPtr(ref r_mut)) => l_mut.mutbl == r_mut.mutbl && self.eq_ty(&*l_mut.ty, &*r_mut.ty),
             (&TyRptr(_, ref l_rmut), &TyRptr(_, ref r_rmut)) => {
                 l_rmut.mutbl == r_rmut.mutbl && self.eq_ty(&*l_rmut.ty, &*r_rmut.ty)
index d9667d9115d33f9f6a73e7f472679bbbfc0bafa4..457008eb0ef2fbb6174ab6c842055ebcf78cf346 100644 (file)
@@ -53,7 +53,10 @@ fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplI
         match item.vis {
             hir::Visibility::Public => println!("public"),
             hir::Visibility::Crate => println!("visible crate wide"),
-            hir::Visibility::Restricted { ref path, .. } => println!("visible in module `{}`", print::to_string(print::NO_ANN, |s| s.print_path(path, false))),
+            hir::Visibility::Restricted { ref path, .. } => {
+                println!("visible in module `{}`",
+                         print::to_string(print::NO_ANN, |s| s.print_path(path, false)))
+            },
             hir::Visibility::Inherited => println!("visibility inherited from outer item"),
         }
         if item.defaultness.is_default() {
@@ -340,7 +343,10 @@ fn print_item(cx: &LateContext, item: &hir::Item) {
     match item.vis {
         hir::Visibility::Public => println!("public"),
         hir::Visibility::Crate => println!("visible crate wide"),
-        hir::Visibility::Restricted { ref path, .. } => println!("visible in module `{}`", print::to_string(print::NO_ANN, |s| s.print_path(path, false))),
+        hir::Visibility::Restricted { ref path, .. } => {
+            println!("visible in module `{}`",
+                     print::to_string(print::NO_ANN, |s| s.print_path(path, false)))
+        },
         hir::Visibility::Inherited => println!("visibility inherited from outer item"),
     }
     match item.node {
@@ -414,7 +420,9 @@ fn print_pat(cx: &LateContext, pat: &hir::Pat, indent: usize) {
         },
         hir::PatKind::Struct(ref path, ref fields, ignore) => {
             println!("{}Struct", ind);
-            println!("{}name: {}", ind, print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)));
+            println!("{}name: {}",
+                     ind,
+                     print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)));
             println!("{}ignore leftover fields: {}", ind, ignore);
             println!("{}fields:", ind);
             for field in fields {
@@ -427,7 +435,9 @@ fn print_pat(cx: &LateContext, pat: &hir::Pat, indent: usize) {
         },
         hir::PatKind::TupleStruct(ref path, ref fields, opt_dots_position) => {
             println!("{}TupleStruct", ind);
-            println!("{}path: {}", ind, print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)));
+            println!("{}path: {}",
+                     ind,
+                     print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)));
             if let Some(dot_position) = opt_dots_position {
                 println!("{}dot position: {}", ind, dot_position);
             }
index 7ef2e89cdaae2f4690be08ecc455f27bf14bd896..f971779b2edb3e8fe53427b662e8f93f498ba200 100644 (file)
@@ -917,6 +917,6 @@ pub fn is_self_ty(slf: &Ty) -> bool {
     false
 }
 
-pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body) -> impl Iterator<Item=&'tcx Arg> {
+pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body) -> impl Iterator<Item = &'tcx Arg> {
     (0..decl.inputs.len()).map(move |i| &body.arguments[i])
-}
\ No newline at end of file
+}