Skip to content

Commit

Permalink
Auto merge of #4534 - matthiaskrgr:fmt_, r=flip1995
Browse files Browse the repository at this point in the history
run rustfmt

I was getting local `cargo test` failures because of this, yet travis was green.

changelog: none
  • Loading branch information
bors committed Sep 11, 2019
2 parents 12bb7d6 + b729827 commit dfa88c6
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions clippy_lints/src/needless_pass_by_value.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 4 additions & 2 deletions clippy_lints/src/ptr.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/swap.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
10 changes: 6 additions & 4 deletions clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/or_fun_call.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -110,5 +109,4 @@ fn f() -> Option<()> {
Some(())
}


fn main() {}
2 changes: 0 additions & 2 deletions tests/ui/or_fun_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -110,5 +109,4 @@ fn f() -> Option<()> {
Some(())
}


fn main() {}

0 comments on commit dfa88c6

Please sign in to comment.