From 5864072eca08dd09d1dfeb0f6bd07dfd97dbbe6d Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 1 Aug 2017 10:19:49 +0200 Subject: [PATCH] Run rustfmt --- clippy_lints/src/literal_digit_grouping.rs | 45 +++++++++------------- clippy_lints/src/misc.rs | 8 ++-- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/clippy_lints/src/literal_digit_grouping.rs b/clippy_lints/src/literal_digit_grouping.rs index ec80e6968f8..2ad26cbc36e 100644 --- a/clippy_lints/src/literal_digit_grouping.rs +++ b/clippy_lints/src/literal_digit_grouping.rs @@ -146,8 +146,7 @@ fn grouping_hint(&self) -> String { let group_size = self.radix.suggest_grouping(); if self.digits.contains('.') { let mut parts = self.digits.split('.'); - let int_part_hint = parts - .next() + let int_part_hint = parts.next() .unwrap() .chars() .rev() @@ -158,8 +157,7 @@ fn grouping_hint(&self) -> String { .rev() .collect::>() .join("_"); - let frac_part_hint = parts - .next() + let frac_part_hint = parts.next() .unwrap() .chars() .filter(|&c| c != '_') @@ -196,31 +194,25 @@ impl WarningType { pub fn display(&self, grouping_hint: &str, cx: &EarlyContext, span: &syntax_pos::Span) { match *self { WarningType::UnreadableLiteral => { - span_help_and_lint( - cx, - UNREADABLE_LITERAL, - *span, - "long literal lacking separators", - &format!("consider: {}", grouping_hint), - ) + span_help_and_lint(cx, + UNREADABLE_LITERAL, + *span, + "long literal lacking separators", + &format!("consider: {}", grouping_hint)) }, WarningType::LargeDigitGroups => { - span_help_and_lint( - cx, - LARGE_DIGIT_GROUPS, - *span, - "digit groups should be smaller", - &format!("consider: {}", grouping_hint), - ) + span_help_and_lint(cx, + LARGE_DIGIT_GROUPS, + *span, + "digit groups should be smaller", + &format!("consider: {}", grouping_hint)) }, WarningType::InconsistentDigitGrouping => { - span_help_and_lint( - cx, - INCONSISTENT_DIGIT_GROUPING, - *span, - "digits grouped inconsistently by underscores", - &format!("consider: {}", grouping_hint), - ) + span_help_and_lint(cx, + INCONSISTENT_DIGIT_GROUPING, + *span, + "digits grouped inconsistently by underscores", + &format!("consider: {}", grouping_hint)) }, }; } @@ -317,8 +309,7 @@ fn parts_consistent(int_group_size: usize, frac_group_size: usize, int_size: usi /// size on success or `WarningType` when emitting a warning. fn do_lint(digits: &str) -> Result { // Grab underscore indices with respect to the units digit. - let underscore_positions: Vec = digits - .chars() + let underscore_positions: Vec = digits.chars() .rev() .enumerate() .filter_map(|(idx, digit)| if digit == '_' { Some(idx) } else { None }) diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 7fa2075b41e..1804e04d17f 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -226,13 +226,15 @@ fn check_fn( } for arg in iter_input_pats(decl, body) { match arg.pat.node { - PatKind::Binding(BindingAnnotation::Ref, _, _, _) | PatKind::Binding(BindingAnnotation::RefMut, _, _, _) => { + PatKind::Binding(BindingAnnotation::Ref, _, _, _) | + PatKind::Binding(BindingAnnotation::RefMut, _, _, _) => { span_lint(cx, TOPLEVEL_REF_ARG, arg.pat.span, - "`ref` directly on a function argument is ignored. Consider using a reference type instead."); + "`ref` directly on a function argument is ignored. Consider using a reference type \ + instead."); }, - _ => {} + _ => {}, } } } -- 2.44.0