From b72982759cbcdd6f2e162fcf4a45656d3ad05af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 11 Sep 2019 08:26:57 +0200 Subject: [PATCH] run rustfmt --- clippy_lints/src/loops.rs | 2 +- clippy_lints/src/methods/mod.rs | 10 +++++----- clippy_lints/src/needless_pass_by_value.rs | 4 ++-- clippy_lints/src/ptr.rs | 6 ++++-- clippy_lints/src/swap.rs | 4 ++-- clippy_lints/src/utils/mod.rs | 10 ++++++---- tests/ui/or_fun_call.fixed | 2 -- tests/ui/or_fun_call.rs | 2 -- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 26a4076bac47..882d9889742c 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -11,7 +11,7 @@ use rustc::{declare_lint_pass, declare_tool_lint}; // use rustc::middle::region::CodeExtent; use crate::consts::{constant, Constant}; use crate::utils::usage::mutated_variables; -use crate::utils::{sext, sugg, is_type_diagnostic_item}; +use crate::utils::{is_type_diagnostic_item, sext, sugg}; use rustc::middle::expr_use_visitor::*; use rustc::middle::mem_categorization::cmt_; use rustc::middle::mem_categorization::Categorization; diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 7a2f6fcf28d1..54c93ca0d4e5 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -16,16 +16,16 @@ use rustc::{declare_lint_pass, declare_tool_lint}; use rustc_errors::Applicability; use syntax::ast; use syntax::source_map::Span; -use syntax::symbol::{sym, Symbol, LocalInternedString}; +use syntax::symbol::{sym, LocalInternedString, Symbol}; use crate::utils::usage::mutated_variables; use crate::utils::{ get_arg_name, get_parent_expr, get_trait_def_id, has_iter_method, implements_trait, in_macro, is_copy, is_ctor_function, is_expn_of, is_type_diagnostic_item, iter_input_pats, last_path_segment, match_def_path, - match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, remove_blocks, + match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, paths, remove_blocks, return_ty, same_tys, single_segment_path, snippet, snippet_with_applicability, snippet_with_macro_callsite, - span_lint, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth, - SpanlessEq, sugg, paths, span_help_and_lint + span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, sugg, walk_ptrs_ty, + walk_ptrs_ty_depth, SpanlessEq, }; declare_clippy_lint! { @@ -2988,7 +2988,7 @@ fn contains_return(expr: &hir::Expr) -> bool { } } - let mut visitor = RetCallFinder{ found: false }; + let mut visitor = RetCallFinder { found: false }; visitor.visit_expr(expr); visitor.found } diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index 5fa160e2cd41..16693d8209bc 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -1,7 +1,7 @@ use crate::utils::ptr::get_spans; use crate::utils::{ - get_trait_def_id, implements_trait, is_copy, is_self, match_type, multispan_sugg, paths, snippet, snippet_opt, - span_lint_and_then, is_type_diagnostic_item, + get_trait_def_id, implements_trait, is_copy, is_self, is_type_diagnostic_item, match_type, multispan_sugg, paths, + snippet, snippet_opt, span_lint_and_then, }; use if_chain::if_chain; use matches::matches; diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 1d60460b5a9f..d95d61e4027e 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -1,8 +1,10 @@ //! Checks for usage of `&Vec[_]` and `&String`. use crate::utils::ptr::get_spans; -use crate::utils::{match_qpath, is_type_diagnostic_item, match_type, paths, snippet_opt, - span_lint, span_lint_and_then, walk_ptrs_hir_ty}; +use crate::utils::{ + is_type_diagnostic_item, match_qpath, match_type, paths, snippet_opt, span_lint, span_lint_and_then, + walk_ptrs_hir_ty, +}; use if_chain::if_chain; use rustc::hir::QPath; use rustc::hir::*; diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index a2c2a1c11860..9940269e5b34 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -1,7 +1,7 @@ use crate::utils::sugg::Sugg; use crate::utils::{ - differing_macro_contexts, match_type, is_type_diagnostic_item, paths, snippet, - span_lint_and_then, walk_ptrs_ty, SpanlessEq, + differing_macro_contexts, is_type_diagnostic_item, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty, + SpanlessEq, }; use if_chain::if_chain; use matches::matches; diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 438274fad281..41b472b2764a 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -47,8 +47,8 @@ use syntax::ext::hygiene::ExpnKind; use syntax::source_map::{Span, DUMMY_SP}; use syntax::symbol::{kw, Symbol}; -use crate::reexport::*; use crate::consts::{constant, Constant}; +use crate::reexport::*; /// Returns `true` if the two spans come from differing expansions (i.e., one is /// from a macro and one isn't). @@ -671,15 +671,17 @@ pub fn walk_ptrs_ty_depth(ty: Ty<'_>) -> (Ty<'_>, usize) { } /// Checks whether the given expression is a constant integer of the given value. -/// unlike `is_integer_literal`, this version does const folding +/// unlike `is_integer_literal`, this version does const folding pub fn is_integer_const(cx: &LateContext<'_, '_>, e: &Expr, value: u128) -> bool { if is_integer_literal(e, value) { return true; } let map = cx.tcx.hir(); let parent_item = map.get_parent_item(e.hir_id); - if let Some((Constant::Int(v), _)) = map.maybe_body_owned_by(parent_item) - .and_then(|body_id| constant(cx, cx.tcx.body_tables(body_id), e)) { + if let Some((Constant::Int(v), _)) = map + .maybe_body_owned_by(parent_item) + .and_then(|body_id| constant(cx, cx.tcx.body_tables(body_id), e)) + { value == v } else { false diff --git a/tests/ui/or_fun_call.fixed b/tests/ui/or_fun_call.fixed index 6d9ad16989a2..198d9862e3f7 100644 --- a/tests/ui/or_fun_call.fixed +++ b/tests/ui/or_fun_call.fixed @@ -99,7 +99,6 @@ fn test_or_with_ctors() { .or(Some(Bar(b, Duration::from_secs(2)))); } - // Issue 4514 - early return fn f() -> Option<()> { let a = Some(1); @@ -110,5 +109,4 @@ fn f() -> Option<()> { Some(()) } - fn main() {} diff --git a/tests/ui/or_fun_call.rs b/tests/ui/or_fun_call.rs index 78bcf896ec1d..35fd0a30f6ce 100644 --- a/tests/ui/or_fun_call.rs +++ b/tests/ui/or_fun_call.rs @@ -99,7 +99,6 @@ fn test_or_with_ctors() { .or(Some(Bar(b, Duration::from_secs(2)))); } - // Issue 4514 - early return fn f() -> Option<()> { let a = Some(1); @@ -110,5 +109,4 @@ fn f() -> Option<()> { Some(()) } - fn main() {}