mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 00:47:16 +00:00
Auto merge of #4534 - matthiaskrgr:fmt_, r=flip1995
run rustfmt I was getting local `cargo test` failures because of this, yet travis was green. changelog: none
This commit is contained in:
commit
dfa88c6841
8 changed files with 20 additions and 20 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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::*;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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).
|
||||
|
@ -678,8 +678,10 @@ pub fn is_integer_const(cx: &LateContext<'_, '_>, e: &Expr, value: u128) -> bool
|
|||
}
|
||||
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
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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() {}
|
||||
|
|
Loading…
Reference in a new issue