Run rustfmt
This commit is contained in:
@@ -146,8 +146,7 @@ impl<'a> DigitInfo<'a> {
|
|||||||
let group_size = self.radix.suggest_grouping();
|
let group_size = self.radix.suggest_grouping();
|
||||||
if self.digits.contains('.') {
|
if self.digits.contains('.') {
|
||||||
let mut parts = self.digits.split('.');
|
let mut parts = self.digits.split('.');
|
||||||
let int_part_hint = parts
|
let int_part_hint = parts.next()
|
||||||
.next()
|
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.chars()
|
.chars()
|
||||||
.rev()
|
.rev()
|
||||||
@@ -158,8 +157,7 @@ impl<'a> DigitInfo<'a> {
|
|||||||
.rev()
|
.rev()
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.join("_");
|
.join("_");
|
||||||
let frac_part_hint = parts
|
let frac_part_hint = parts.next()
|
||||||
.next()
|
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.chars()
|
.chars()
|
||||||
.filter(|&c| c != '_')
|
.filter(|&c| c != '_')
|
||||||
@@ -196,31 +194,25 @@ impl WarningType {
|
|||||||
pub fn display(&self, grouping_hint: &str, cx: &EarlyContext, span: &syntax_pos::Span) {
|
pub fn display(&self, grouping_hint: &str, cx: &EarlyContext, span: &syntax_pos::Span) {
|
||||||
match *self {
|
match *self {
|
||||||
WarningType::UnreadableLiteral => {
|
WarningType::UnreadableLiteral => {
|
||||||
span_help_and_lint(
|
span_help_and_lint(cx,
|
||||||
cx,
|
|
||||||
UNREADABLE_LITERAL,
|
UNREADABLE_LITERAL,
|
||||||
*span,
|
*span,
|
||||||
"long literal lacking separators",
|
"long literal lacking separators",
|
||||||
&format!("consider: {}", grouping_hint),
|
&format!("consider: {}", grouping_hint))
|
||||||
)
|
|
||||||
},
|
},
|
||||||
WarningType::LargeDigitGroups => {
|
WarningType::LargeDigitGroups => {
|
||||||
span_help_and_lint(
|
span_help_and_lint(cx,
|
||||||
cx,
|
|
||||||
LARGE_DIGIT_GROUPS,
|
LARGE_DIGIT_GROUPS,
|
||||||
*span,
|
*span,
|
||||||
"digit groups should be smaller",
|
"digit groups should be smaller",
|
||||||
&format!("consider: {}", grouping_hint),
|
&format!("consider: {}", grouping_hint))
|
||||||
)
|
|
||||||
},
|
},
|
||||||
WarningType::InconsistentDigitGrouping => {
|
WarningType::InconsistentDigitGrouping => {
|
||||||
span_help_and_lint(
|
span_help_and_lint(cx,
|
||||||
cx,
|
|
||||||
INCONSISTENT_DIGIT_GROUPING,
|
INCONSISTENT_DIGIT_GROUPING,
|
||||||
*span,
|
*span,
|
||||||
"digits grouped inconsistently by underscores",
|
"digits grouped inconsistently by underscores",
|
||||||
&format!("consider: {}", grouping_hint),
|
&format!("consider: {}", grouping_hint))
|
||||||
)
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -317,8 +309,7 @@ impl LiteralDigitGrouping {
|
|||||||
/// size on success or `WarningType` when emitting a warning.
|
/// size on success or `WarningType` when emitting a warning.
|
||||||
fn do_lint(digits: &str) -> Result<usize, WarningType> {
|
fn do_lint(digits: &str) -> Result<usize, WarningType> {
|
||||||
// Grab underscore indices with respect to the units digit.
|
// Grab underscore indices with respect to the units digit.
|
||||||
let underscore_positions: Vec<usize> = digits
|
let underscore_positions: Vec<usize> = digits.chars()
|
||||||
.chars()
|
|
||||||
.rev()
|
.rev()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter_map(|(idx, digit)| if digit == '_' { Some(idx) } else { None })
|
.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) {
|
for arg in iter_input_pats(decl, body) {
|
||||||
match arg.pat.node {
|
match arg.pat.node {
|
||||||
PatKind::Binding(BindingAnnotation::Ref, _, _, _) | PatKind::Binding(BindingAnnotation::RefMut, _, _, _) => {
|
PatKind::Binding(BindingAnnotation::Ref, _, _, _) |
|
||||||
|
PatKind::Binding(BindingAnnotation::RefMut, _, _, _) => {
|
||||||
span_lint(cx,
|
span_lint(cx,
|
||||||
TOPLEVEL_REF_ARG,
|
TOPLEVEL_REF_ARG,
|
||||||
arg.pat.span,
|
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.");
|
||||||
},
|
},
|
||||||
_ => {}
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user