]> git.lizzy.rs Git - rust.git/commitdiff
function definition style simplification
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Wed, 21 Dec 2016 11:14:54 +0000 (12:14 +0100)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Wed, 21 Dec 2016 11:14:54 +0000 (12:14 +0100)
19 files changed:
clippy_lints/src/array_indexing.rs
clippy_lints/src/copies.rs
clippy_lints/src/derive.rs
clippy_lints/src/entry.rs
clippy_lints/src/enum_variants.rs
clippy_lints/src/escape.rs
clippy_lints/src/functions.rs
clippy_lints/src/let_if_seq.rs
clippy_lints/src/lifetimes.rs
clippy_lints/src/loops.rs
clippy_lints/src/matches.rs
clippy_lints/src/methods.rs
clippy_lints/src/misc.rs
clippy_lints/src/new_without_default.rs
clippy_lints/src/shadow.rs
clippy_lints/src/types.rs
clippy_lints/src/unused_label.rs
clippy_lints/src/utils/mod.rs
rustfmt.toml

index aa9af2e681d4e659b8a23b80f598f5117dc71e97..de13c0264e5032e0645f5bace35fe9ad4e0d601d 100644 (file)
@@ -107,8 +107,12 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) {
 }
 
 /// Returns an option containing a tuple with the start and end (exclusive) of the range.
-fn to_const_range(start: Option<Option<ConstVal>>, end: Option<Option<ConstVal>>, limits: RangeLimits, array_size: ConstInt)
-    -> Option<(ConstInt, ConstInt)> {
+fn to_const_range(
+    start: Option<Option<ConstVal>>,
+    end: Option<Option<ConstVal>>,
+    limits: RangeLimits,
+    array_size: ConstInt
+) -> Option<(ConstInt, ConstInt)> {
     let start = match start {
         Some(Some(ConstVal::Integral(x))) => x,
         Some(_) => return None,
index 9a9b97d0e813a44710c2d9ec9dad0fc060603450..11b85edba3e696711e697ba8c94c3534dc1c3dc7 100644 (file)
@@ -248,7 +248,11 @@ fn if_sequence(mut expr: &Expr) -> (SmallVector<&Expr>, SmallVector<&Block>) {
 
 /// Return the list of bindings in a pattern.
 fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<InternedString, ty::Ty<'tcx>> {
-    fn bindings_impl<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat, map: &mut HashMap<InternedString, ty::Ty<'tcx>>) {
+    fn bindings_impl<'a, 'tcx>(
+        cx: &LateContext<'a, 'tcx>,
+        pat: &Pat,
+        map: &mut HashMap<InternedString, ty::Ty<'tcx>>
+    ) {
         match pat.node {
             PatKind::Box(ref pat) |
             PatKind::Ref(ref pat, _) => bindings_impl(cx, pat, map),
index 8836af28d095b2ddd3f9325936f0dd569b4ee971..cda82f46434e167b0144876b105df877444437ca 100644 (file)
@@ -86,8 +86,13 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
 }
 
 /// Implementation of the `DERIVE_HASH_XOR_EQ` lint.
-fn check_hash_peq<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, span: Span, trait_ref: &TraitRef, ty: ty::Ty<'tcx>,
-                            hash_is_automatically_derived: bool) {
+fn check_hash_peq<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    span: Span,
+    trait_ref: &TraitRef,
+    ty: ty::Ty<'tcx>,
+    hash_is_automatically_derived: bool
+) {
     if_let_chain! {[
         match_path_old(&trait_ref.path, &paths::HASH),
         let Some(peq_trait_def_id) = cx.tcx.lang_items.eq_trait()
index 2ff31b3a4fece14baf412f1171fec206e50ab72a..2fe53d8cacf4c30e2ee462cf442c55d4e100c144 100644 (file)
@@ -78,8 +78,10 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
     }
 }
 
-fn check_cond<'a, 'tcx, 'b>(cx: &'a LateContext<'a, 'tcx>, check: &'b Expr)
-    -> Option<(&'static str, &'b Expr, &'b Expr)> {
+fn check_cond<'a, 'tcx, 'b>(
+    cx: &'a LateContext<'a, 'tcx>,
+    check: &'b Expr
+) -> Option<(&'static str, &'b Expr, &'b Expr)> {
     if_let_chain! {[
         let ExprMethodCall(ref name, _, ref params) = check.node,
         params.len() >= 2,
index e3bfca0b2f525b9e51e8d4c180434f1e7ffef6b8..5ae3fcbb2a1e19d8ff51f8522ca79665e94046f3 100644 (file)
@@ -114,7 +114,14 @@ fn partial_rmatch(post: &str, name: &str) -> usize {
 
 // FIXME: #600
 #[allow(while_let_on_iterator)]
-fn check_variant(cx: &EarlyContext, threshold: u64, def: &EnumDef, item_name: &str, item_name_chars: usize, span: Span) {
+fn check_variant(
+    cx: &EarlyContext,
+    threshold: u64,
+    def: &EnumDef,
+    item_name: &str,
+    item_name_chars: usize,
+    span: Span
+) {
     if (def.variants.len() as u64) < threshold {
         return;
     }
index d66c8757ef2dfaf8f75c1b75b9ae48241d16af66..ee415b36382439cd000855a40eba0543984133fa 100644 (file)
@@ -62,7 +62,12 @@ fn get_lints(&self) -> LintArray {
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
     fn check_fn(
-        &mut self, cx: &LateContext<'a, 'tcx>, _: visit::FnKind<'tcx>, decl: &'tcx FnDecl, body: &'tcx Expr, _: Span,
+        &mut self,
+        cx: &LateContext<'a, 'tcx>,
+        _: visit::FnKind<'tcx>,
+        decl: &'tcx FnDecl,
+        body: &'tcx Expr,
+        _: Span,
         id: NodeId
     ) {
         let param_env = ty::ParameterEnvironment::for_item(cx.tcx, id);
@@ -146,8 +151,15 @@ fn consume_pat(&mut self, consume_pat: &Pat, cmt: cmt<'tcx>, _: ConsumeMode) {
         }
 
     }
-    fn borrow(&mut self, borrow_id: NodeId, _: Span, cmt: cmt<'tcx>, _: &ty::Region, _: ty::BorrowKind,
-              loan_cause: LoanCause) {
+    fn borrow(
+        &mut self,
+        borrow_id: NodeId,
+        _: Span,
+        cmt: cmt<'tcx>,
+        _: &ty::Region,
+        _: ty::BorrowKind,
+        loan_cause: LoanCause
+    ) {
         use rustc::ty::adjustment::Adjust;
 
         if let Categorization::Local(lid) = cmt.cat {
index 58425ff2a40125c0e998de748ffccc752e550ac4..5ad676e57a088644b4f938256666c00e7e346b99 100644 (file)
@@ -70,8 +70,13 @@ fn get_lints(&self) -> LintArray {
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
     fn check_fn(
-        &mut self, cx: &LateContext<'a, 'tcx>, kind: intravisit::FnKind<'tcx>, decl: &'tcx hir::FnDecl,
-        expr: &'tcx hir::Expr, span: Span, nodeid: ast::NodeId
+        &mut self,
+        cx: &LateContext<'a, 'tcx>,
+        kind: intravisit::FnKind<'tcx>,
+        decl: &'tcx hir::FnDecl,
+        expr: &'tcx hir::Expr,
+        span: Span,
+        nodeid: ast::NodeId
     ) {
         use rustc::hir::map::Node::*;
 
@@ -127,7 +132,11 @@ fn check_arg_number(&self, cx: &LateContext, decl: &hir::FnDecl, span: Span) {
     }
 
     fn check_raw_ptr(
-        &self, cx: &LateContext<'a, 'tcx>, unsafety: hir::Unsafety, decl: &'tcx hir::FnDecl, expr: &'tcx hir::Expr,
+        &self,
+        cx: &LateContext<'a, 'tcx>,
+        unsafety: hir::Unsafety,
+        decl: &'tcx hir::FnDecl,
+        expr: &'tcx hir::Expr,
         nodeid: ast::NodeId
     ) {
         if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(nodeid) {
index c6efc3fd736de092692af0f8e3a60cd8f9a78fbd..88d74b01886335e69e58edbee8009119acaa78b1 100644 (file)
@@ -149,8 +149,11 @@ fn nested_visit_map<'this>(&'this mut self) -> hir::intravisit::NestedVisitorMap
     }
 }
 
-fn check_assign<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, decl: hir::def_id::DefId, block: &'tcx hir::Block)
-    -> Option<&'tcx hir::Expr> {
+fn check_assign<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    decl: hir::def_id::DefId,
+    block: &'tcx hir::Block
+) -> Option<&'tcx hir::Expr> {
     if_let_chain! {[
         block.expr.is_none(),
         let Some(expr) = block.stmts.iter().last(),
index e9f93d0436040363ed9549ac83e9b8b87a53fe79..ba705a84089c3db6e33f5ee4787c2ef992659a60 100644 (file)
@@ -116,8 +116,12 @@ fn check_fn_inner<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl, gene
     report_extra_lifetimes(cx, decl, generics);
 }
 
-fn could_use_elision<'a, 'tcx: 'a, T: Iterator<Item = &'tcx Lifetime>>(cx: &LateContext<'a, 'tcx>, func: &'tcx FnDecl, named_lts: &'tcx [LifetimeDef], bounds_lts: T)
-    -> bool {
+fn could_use_elision<'a, 'tcx: 'a, T: Iterator<Item = &'tcx Lifetime>>(
+    cx: &LateContext<'a, 'tcx>,
+    func: &'tcx FnDecl,
+    named_lts: &'tcx [LifetimeDef],
+    bounds_lts: T
+) -> bool {
     // There are two scenarios where elision works:
     // * no output references, all input references have different LT
     // * output references, exactly one input reference with same LT
index 3a7012972ba1a6378054953e1ee9806f5592a406..9a3defec72df682535d76925c32c269dcf4bf0c8 100644 (file)
@@ -402,8 +402,13 @@ fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
     }
 }
 
-fn check_for_loop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat, arg: &'tcx Expr, body: &'tcx Expr,
-                            expr: &'tcx Expr) {
+fn check_for_loop<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    pat: &'tcx Pat,
+    arg: &'tcx Expr,
+    body: &'tcx Expr,
+    expr: &'tcx Expr
+) {
     check_for_loop_range(cx, pat, arg, body, expr);
     check_for_loop_reverse_range(cx, arg, expr);
     check_for_loop_arg(cx, pat, arg, expr);
@@ -413,8 +418,13 @@ fn check_for_loop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat, arg: &'t
 
 /// Check for looping over a range and then indexing a sequence with it.
 /// The iteratee must be a range literal.
-fn check_for_loop_range<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat, arg: &'tcx Expr, body: &'tcx Expr,
-                                  expr: &'tcx Expr) {
+fn check_for_loop_range<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    pat: &'tcx Pat,
+    arg: &'tcx Expr,
+    body: &'tcx Expr,
+    expr: &'tcx Expr
+) {
     if let Some(higher::Range { start: Some(start), ref end, limits }) = higher::range(arg) {
         // the var must be a single name
         if let PatKind::Binding(_, def_id, ref ident, _) = pat.node {
@@ -641,8 +651,12 @@ fn check_arg_type(cx: &LateContext, pat: &Pat, arg: &Expr) {
     }
 }
 
-fn check_for_loop_explicit_counter<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arg: &'tcx Expr, body: &'tcx Expr,
-                                             expr: &'tcx Expr) {
+fn check_for_loop_explicit_counter<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    arg: &'tcx Expr,
+    body: &'tcx Expr,
+    expr: &'tcx Expr
+) {
     // Look for variables that are incremented once per loop iteration.
     let mut visitor = IncrementVisitor {
         cx: cx,
@@ -687,8 +701,13 @@ fn check_for_loop_explicit_counter<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arg: &'
 }
 
 /// Check for the `FOR_KV_MAP` lint.
-fn check_for_loop_over_map_kv<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat, arg: &'tcx Expr,
-                                        body: &'tcx Expr, expr: &'tcx Expr) {
+fn check_for_loop_over_map_kv<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    pat: &'tcx Pat,
+    arg: &'tcx Expr,
+    body: &'tcx Expr,
+    expr: &'tcx Expr
+) {
     let pat_span = pat.span;
 
     if let PatKind::Tuple(ref pat, _) = pat.node {
index b1b52cfb015322528b679cb09571cd646249ebe8..978e9f5a029fec8b2afe0a0bffa2b1e33fd9c7fa 100644 (file)
@@ -196,7 +196,14 @@ fn check_single_match_single_pattern(cx: &LateContext, ex: &Expr, arms: &[Arm],
     }
 }
 
-fn check_single_match_opt_like(cx: &LateContext, ex: &Expr, arms: &[Arm], expr: &Expr, ty: ty::Ty, els: Option<&Expr>) {
+fn check_single_match_opt_like(
+    cx: &LateContext,
+    ex: &Expr,
+    arms: &[Arm],
+    expr: &Expr,
+    ty: ty::Ty,
+    els: Option<&Expr>
+) {
     // list of candidate Enums we know will never get any more members
     let candidates = &[(&paths::COW, "Borrowed"),
                        (&paths::COW, "Cow::Borrowed"),
index ebb90c9eef08a1353809a596728074afb6112978..591b395fe7099d247b68bd427ea8eeeca372f0fb 100644 (file)
@@ -696,7 +696,12 @@ fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, implitem: &'tcx hir::I
 fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir::Expr]) {
     /// Check for `unwrap_or(T::new())` or `unwrap_or(T::default())`.
     fn check_unwrap_or_default(
-        cx: &LateContext, name: &str, fun: &hir::Expr, self_expr: &hir::Expr, arg: &hir::Expr, or_has_args: bool,
+        cx: &LateContext,
+        name: &str,
+        fun: &hir::Expr,
+        self_expr: &hir::Expr,
+        arg: &hir::Expr,
+        or_has_args: bool,
         span: Span
     ) -> bool {
         if or_has_args {
@@ -737,7 +742,12 @@ fn check_unwrap_or_default(
 
     /// Check for `*or(foo())`.
     fn check_general_case(
-        cx: &LateContext, name: &str, fun: &hir::Expr, self_expr: &hir::Expr, arg: &hir::Expr, or_has_args: bool,
+        cx: &LateContext,
+        name: &str,
+        fun: &hir::Expr,
+        self_expr: &hir::Expr,
+        arg: &hir::Expr,
+        or_has_args: bool,
         span: Span
     ) {
         // don't lint for constant values
@@ -1157,8 +1167,13 @@ fn lint_filter_map_flat_map(cx: &LateContext, expr: &hir::Expr, _filter_args: &[
 }
 
 /// lint searching an Iterator followed by `is_some()`
-fn lint_search_is_some(cx: &LateContext, expr: &hir::Expr, search_method: &str, search_args: &[hir::Expr],
-                       is_some_args: &[hir::Expr]) {
+fn lint_search_is_some(
+    cx: &LateContext,
+    expr: &hir::Expr,
+    search_method: &str,
+    search_args: &[hir::Expr],
+    is_some_args: &[hir::Expr]
+) {
     // lint if caller of search is an Iterator
     if match_trait_method(cx, &is_some_args[0], &paths::ITERATOR) {
         let msg = format!("called `is_some()` after searching an `Iterator` with {}. This is more succinctly \
index f796207a22392e0f4c0b6d454014b974f2c85dff..409a7de86f06d4e57ae19521587d47437f1b73d2 100644 (file)
@@ -170,8 +170,15 @@ fn get_lints(&self) -> LintArray {
 }
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
-    fn check_fn(&mut self, cx: &LateContext<'a, 'tcx>, k: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span,
-                _: NodeId) {
+    fn check_fn(
+        &mut self,
+        cx: &LateContext<'a, 'tcx>,
+        k: FnKind<'tcx>,
+        decl: &'tcx FnDecl,
+        _: &'tcx Expr,
+        _: Span,
+        _: NodeId
+    ) {
         if let FnKind::Closure(_) = k {
             // Does not apply to closures
             return;
index 2a75a19dd28cc9698228e2579f39bb735b6cc726..9c7b132dd3d6d0b72e9453cbe66c442ffe479c76 100644 (file)
@@ -91,8 +91,13 @@ fn get_lints(&self) -> LintArray {
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
     fn check_fn(
-        &mut self, cx: &LateContext<'a, 'tcx>, kind: FnKind<'tcx>, decl: &'tcx hir::FnDecl, _: &'tcx hir::Expr,
-        span: Span, id: ast::NodeId
+        &mut self,
+        cx: &LateContext<'a, 'tcx>,
+        kind: FnKind<'tcx>,
+        decl: &'tcx hir::FnDecl,
+        _: &'tcx hir::Expr,
+        span: Span,
+        id: ast::NodeId
     ) {
         if in_external_macro(cx, span) {
             return;
index 36fd33b22ce4dbea264e81b4293845bf3a4aeb61..9c5b032f6251e5b4636faaf8f1b3b76738c5a11c 100644 (file)
@@ -80,8 +80,15 @@ fn get_lints(&self) -> LintArray {
 }
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
-    fn check_fn(&mut self, cx: &LateContext<'a, 'tcx>, _: FnKind<'tcx>, decl: &'tcx FnDecl, expr: &'tcx Expr,
-                _: Span, _: NodeId) {
+    fn check_fn(
+        &mut self,
+        cx: &LateContext<'a, 'tcx>,
+        _: FnKind<'tcx>,
+        decl: &'tcx FnDecl,
+        expr: &'tcx Expr,
+        _: Span,
+        _: NodeId
+    ) {
         if in_external_macro(cx, expr.span) {
             return;
         }
@@ -143,8 +150,13 @@ fn is_binding(cx: &LateContext, pat_id: NodeId) -> bool {
     }
 }
 
-fn check_pat<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat, init: Option<&'tcx Expr>, span: Span,
-                       bindings: &mut Vec<(Name, Span)>) {
+fn check_pat<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    pat: &'tcx Pat,
+    init: Option<&'tcx Expr>,
+    span: Span,
+    bindings: &mut Vec<(Name, Span)>
+) {
     // TODO: match more stuff / destructuring
     match pat.node {
         PatKind::Binding(_, _, ref ident, ref inner) => {
@@ -222,8 +234,14 @@ fn check_pat<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat, init: Option<
     }
 }
 
-fn lint_shadow<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, name: Name, span: Span, pattern_span: Span,
-                             init: Option<&'tcx Expr>, prev_span: Span) {
+fn lint_shadow<'a, 'tcx: 'a>(
+    cx: &LateContext<'a, 'tcx>,
+    name: Name,
+    span: Span,
+    pattern_span: Span,
+    init: Option<&'tcx Expr>,
+    prev_span: Span
+) {
     if let Some(expr) = init {
         if is_self_shadow(name, expr) {
             span_lint_and_then(cx,
index e3a9758d2b726d69f55896ba3bcfbdf08524c1c3..89bc46074fda4adabf31d47a4428c16d31e0f10f 100644 (file)
@@ -528,8 +528,15 @@ fn get_lints(&self) -> LintArray {
 }
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexityPass {
-    fn check_fn(&mut self, cx: &LateContext<'a, 'tcx>, _: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span,
-                _: NodeId) {
+    fn check_fn(
+        &mut self,
+        cx: &LateContext<'a, 'tcx>,
+        _: FnKind<'tcx>,
+        decl: &'tcx FnDecl,
+        _: &'tcx Expr,
+        _: Span,
+        _: NodeId
+    ) {
         self.check_fndecl(cx, decl);
     }
 
@@ -740,8 +747,12 @@ enum AbsurdComparisonResult {
 
 
 
-fn detect_absurd_comparison<'a>(cx: &LateContext, op: BinOp_, lhs: &'a Expr, rhs: &'a Expr)
-    -> Option<(ExtremeExpr<'a>, AbsurdComparisonResult)> {
+fn detect_absurd_comparison<'a>(
+    cx: &LateContext,
+    op: BinOp_,
+    lhs: &'a Expr,
+    rhs: &'a Expr
+) -> Option<(ExtremeExpr<'a>, AbsurdComparisonResult)> {
     use types::ExtremeType::*;
     use types::AbsurdComparisonResult::*;
     use utils::comparisons::*;
@@ -1008,8 +1019,13 @@ fn err_upcast_comparison(cx: &LateContext, span: &Span, expr: &Expr, always: boo
 }
 
 fn upcast_comparison_bounds_err(
-    cx: &LateContext, span: &Span, rel: comparisons::Rel, lhs_bounds: Option<(FullInt, FullInt)>, lhs: &Expr,
-    rhs: &Expr, invert: bool
+    cx: &LateContext,
+    span: &Span,
+    rel: comparisons::Rel,
+    lhs_bounds: Option<(FullInt, FullInt)>,
+    lhs: &Expr,
+    rhs: &Expr,
+    invert: bool
 ) {
     use utils::comparisons::*;
 
index ebb7735171eed460e1a26d3f07a58e4ea52892ae..9017fd6933e81b04f6e66bad4b7aa04217947ceb 100644 (file)
@@ -42,8 +42,13 @@ fn get_lints(&self) -> LintArray {
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel {
     fn check_fn(
-        &mut self, cx: &LateContext<'a, 'tcx>, kind: FnKind<'tcx>, decl: &'tcx hir::FnDecl, body: &'tcx hir::Expr,
-        span: Span, fn_id: ast::NodeId
+        &mut self,
+        cx: &LateContext<'a, 'tcx>,
+        kind: FnKind<'tcx>,
+        decl: &'tcx hir::FnDecl,
+        body: &'tcx hir::Expr,
+        span: Span,
+        fn_id: ast::NodeId
     ) {
         if in_macro(cx, span) {
             return;
index dc25020d3fc95b87e281879d7638f20fbccda3c5..77b33d7b58939b14652146a094042781f30a2d52 100644 (file)
@@ -317,8 +317,12 @@ pub fn get_trait_def_id(cx: &LateContext, path: &[&str]) -> Option<DefId> {
 
 /// Check whether a type implements a trait.
 /// See also `get_trait_def_id`.
-pub fn implements_trait<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>, trait_id: DefId, ty_params: Vec<ty::Ty<'tcx>>)
-    -> bool {
+pub fn implements_trait<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    ty: ty::Ty<'tcx>,
+    trait_id: DefId,
+    ty_params: Vec<ty::Ty<'tcx>>
+) -> bool {
     cx.tcx.populate_implementations_for_trait_if_necessary(trait_id);
 
     let ty = cx.tcx.erase_regions(&ty);
@@ -401,8 +405,12 @@ pub fn snippet_block<'a, 'b, T: LintContext<'b>>(cx: &T, span: Span, default: &'
 
 /// Like `snippet_block`, but add braces if the expr is not an `ExprBlock`.
 /// Also takes an `Option<String>` which can be put inside the braces.
-pub fn expr_block<'a, 'b, T: LintContext<'b>>(cx: &T, expr: &Expr, option: Option<String>, default: &'a str)
-    -> Cow<'a, str> {
+pub fn expr_block<'a, 'b, T: LintContext<'b>>(
+    cx: &T,
+    expr: &Expr,
+    option: Option<String>,
+    default: &'a str
+) -> Cow<'a, str> {
     let code = snippet_block(cx, expr.span, default);
     let string = option.unwrap_or_default();
     if let ExprBlock(_) = expr.node {
@@ -515,8 +523,13 @@ pub fn span_lint<'a, T: LintContext<'a>>(cx: &T, lint: &'static Lint, sp: Span,
     }
 }
 
-pub fn span_help_and_lint<'a, 'tcx: 'a, T: LintContext<'tcx>>(cx: &'a T, lint: &'static Lint, span: Span, msg: &str,
-                                                              help: &str) {
+pub fn span_help_and_lint<'a, 'tcx: 'a, T: LintContext<'tcx>>(
+    cx: &'a T,
+    lint: &'static Lint,
+    span: Span,
+    msg: &str,
+    help: &str
+) {
     let mut db = DiagnosticWrapper(cx.struct_span_lint(lint, span, msg));
     if cx.current_level(lint) != Level::Allow {
         db.0.help(help);
@@ -524,8 +537,14 @@ pub fn span_help_and_lint<'a, 'tcx: 'a, T: LintContext<'tcx>>(cx: &'a T, lint: &
     }
 }
 
-pub fn span_note_and_lint<'a, 'tcx: 'a, T: LintContext<'tcx>>(cx: &'a T, lint: &'static Lint, span: Span, msg: &str,
-                                                              note_span: Span, note: &str) {
+pub fn span_note_and_lint<'a, 'tcx: 'a, T: LintContext<'tcx>>(
+    cx: &'a T,
+    lint: &'static Lint,
+    span: Span,
+    msg: &str,
+    note_span: Span,
+    note: &str
+) {
     let mut db = DiagnosticWrapper(cx.struct_span_lint(lint, span, msg));
     if cx.current_level(lint) != Level::Allow {
         if note_span == span {
@@ -537,9 +556,13 @@ pub fn span_note_and_lint<'a, 'tcx: 'a, T: LintContext<'tcx>>(cx: &'a T, lint: &
     }
 }
 
-pub fn span_lint_and_then<'a, 'tcx: 'a, T: LintContext<'tcx>, F>(cx: &'a T, lint: &'static Lint, sp: Span, msg: &str,
-                                                                 f: F)
-    where F: for<'b> FnOnce(&mut DiagnosticBuilder<'b>)
+pub fn span_lint_and_then<'a, 'tcx: 'a, T: LintContext<'tcx>, F>(
+    cx: &'a T,
+    lint: &'static Lint,
+    sp: Span,
+    msg: &str,
+    f: F
+) where F: for<'b> FnOnce(&mut DiagnosticBuilder<'b>)
 {
     let mut db = DiagnosticWrapper(cx.struct_span_lint(lint, sp, msg));
     if cx.current_level(lint) != Level::Allow {
@@ -756,8 +779,12 @@ pub fn return_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, fn_item: NodeId) -> ty::T
 /// Check if two types are the same.
 // FIXME: this works correctly for lifetimes bounds (`for <'a> Foo<'a>` == `for <'b> Foo<'b>` but
 // not for type parameters.
-pub fn same_tys<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, a: ty::Ty<'tcx>, b: ty::Ty<'tcx>, parameter_item: NodeId)
-    -> bool {
+pub fn same_tys<'a, 'tcx>(
+    cx: &LateContext<'a, 'tcx>,
+    a: ty::Ty<'tcx>,
+    b: ty::Ty<'tcx>,
+    parameter_item: NodeId
+) -> bool {
     let parameter_env = ty::ParameterEnvironment::for_item(cx.tcx, parameter_item);
     cx.tcx.infer_ctxt(None, Some(parameter_env), Reveal::All).enter(|infcx| {
         let new_a = a.subst(infcx.tcx, infcx.parameter_environment.free_substs);
index 0d8362496c199b1f20e9684f851d184273cbf6f3..18d146d49173afa0aa52acb60cb7d51a1e245569 100644 (file)
@@ -1,8 +1,6 @@
 max_width = 120
 ideal_width = 100
-fn_args_density = "Compressed"
 fn_call_width = 80
-fn_args_paren_newline = false
 match_block_trailing_comma = true
 fn_args_layout = "Block"
 closure_block_indent_threshold = 0