Run rustfmt
This commit is contained in:
parent
deed00a0a4
commit
5864072eca
@ -146,8 +146,7 @@ impl<'a> DigitInfo<'a> {
|
||||
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 @@ impl<'a> DigitInfo<'a> {
|
||||
.rev()
|
||||
.collect::<Vec<String>>()
|
||||
.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 @@ impl LiteralDigitGrouping {
|
||||
/// size on success or `WarningType` when emitting a warning.
|
||||
fn do_lint(digits: &str) -> Result<usize, WarningType> {
|
||||
// Grab underscore indices with respect to the units digit.
|
||||
let underscore_positions: Vec<usize> = digits
|
||||
.chars()
|
||||
let underscore_positions: Vec<usize> = digits.chars()
|
||||
.rev()
|
||||
.enumerate()
|
||||
.filter_map(|(idx, digit)| if digit == '_' { Some(idx) } else { None })
|
||||
|
@ -226,13 +226,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
||||
}
|
||||
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.");
|
||||
},
|
||||
_ => {}
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user