apply rustfmt
This commit is contained in:
@@ -94,13 +94,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
|
|||||||
MISREFACTORED_ASSIGN_OP,
|
MISREFACTORED_ASSIGN_OP,
|
||||||
expr.span,
|
expr.span,
|
||||||
"variable appears on both sides of an assignment operation",
|
"variable appears on both sides of an assignment operation",
|
||||||
|db| {
|
|db| if let (Some(snip_a), Some(snip_r)) =
|
||||||
if let (Some(snip_a), Some(snip_r)) =
|
|
||||||
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span)) {
|
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span)) {
|
||||||
db.span_suggestion(expr.span,
|
db.span_suggestion(expr.span,
|
||||||
"replace it with",
|
"replace it with",
|
||||||
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r));
|
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// lhs op= l op r
|
// lhs op= l op r
|
||||||
@@ -177,13 +175,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
|
|||||||
ASSIGN_OP_PATTERN,
|
ASSIGN_OP_PATTERN,
|
||||||
expr.span,
|
expr.span,
|
||||||
"manual implementation of an assign operation",
|
"manual implementation of an assign operation",
|
||||||
|db| {
|
|db| if let (Some(snip_a), Some(snip_r)) =
|
||||||
if let (Some(snip_a), Some(snip_r)) =
|
|
||||||
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span)) {
|
(snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span)) {
|
||||||
db.span_suggestion(expr.span,
|
db.span_suggestion(expr.span,
|
||||||
"replace it with",
|
"replace it with",
|
||||||
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r));
|
format!("{} {}= {}", snip_a, op.node.as_str(), snip_r));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ fn fetch_int_literal(cx: &LateContext, lit: &Expr) -> Option<u128> {
|
|||||||
match lit.node {
|
match lit.node {
|
||||||
ExprLit(ref lit_ptr) => {
|
ExprLit(ref lit_ptr) => {
|
||||||
if let LitKind::Int(value, _) = lit_ptr.node {
|
if let LitKind::Int(value, _) = lit_ptr.node {
|
||||||
Some(value) //TODO: Handle sign
|
Some(value) // TODO: Handle sign
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -384,10 +384,8 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
|
|||||||
NONMINIMAL_BOOL,
|
NONMINIMAL_BOOL,
|
||||||
e.span,
|
e.span,
|
||||||
"this boolean expression can be simplified",
|
"this boolean expression can be simplified",
|
||||||
|db| {
|
|db| for suggestion in &improvements {
|
||||||
for suggestion in &improvements {
|
|
||||||
db.span_suggestion(e.span, "try", suggest(self.cx, suggestion, &h2q.terminals));
|
db.span_suggestion(e.span, "try", suggest(self.cx, suggestion, &h2q.terminals));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,12 +270,10 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
ExprUnary(op, ref operand) => {
|
ExprUnary(op, ref operand) => {
|
||||||
self.expr(operand).and_then(|o| {
|
self.expr(operand).and_then(|o| match op {
|
||||||
match op {
|
|
||||||
UnNot => constant_not(o),
|
UnNot => constant_not(o),
|
||||||
UnNeg => constant_negate(o),
|
UnNeg => constant_negate(o),
|
||||||
UnDeref => Some(o),
|
UnDeref => Some(o),
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
ExprBinary(op, ref left, ref right) => self.binop(op, left, right),
|
ExprBinary(op, ref left, ref right) => self.binop(op, left, right),
|
||||||
|
|||||||
@@ -173,8 +173,6 @@ fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item, trait_ref
|
|||||||
EXPL_IMPL_CLONE_ON_COPY,
|
EXPL_IMPL_CLONE_ON_COPY,
|
||||||
item.span,
|
item.span,
|
||||||
"you are implementing `Clone` explicitly on a `Copy` type",
|
"you are implementing `Clone` explicitly on a `Copy` type",
|
||||||
|db| {
|
|db| { db.span_note(item.span, "consider deriving `Clone` or removing `Copy`"); });
|
||||||
db.span_note(item.span, "consider deriving `Clone` or removing `Copy`");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,7 +305,8 @@ fn check_doc(cx: &EarlyContext, valid_idents: &[String], docs: &[(String, Span)]
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try!(parser.jump_to('`')); // not a code block, just inline code
|
// not a code block, just inline code
|
||||||
|
try!(parser.jump_to('`'));
|
||||||
},
|
},
|
||||||
'~' => {
|
'~' => {
|
||||||
if try!(check_block!(parser, '~', new_line)) {
|
if try!(check_block!(parser, '~', new_line)) {
|
||||||
|
|||||||
@@ -206,13 +206,11 @@ impl<'a, 'tcx: 'a> EscapeDelegate<'a, 'tcx> {
|
|||||||
// overflows.
|
// overflows.
|
||||||
match ty.sty {
|
match ty.sty {
|
||||||
ty::TyBox(inner) => {
|
ty::TyBox(inner) => {
|
||||||
self.tcx.infer_ctxt((), Reveal::All).enter(|infcx| {
|
self.tcx.infer_ctxt((), Reveal::All).enter(|infcx| if let Ok(layout) = inner.layout(&infcx) {
|
||||||
if let Ok(layout) = inner.layout(&infcx) {
|
|
||||||
let size = layout.size(&self.target);
|
let size = layout.size(&self.target);
|
||||||
size.bytes() > self.too_large_for_stack
|
size.bytes() > self.too_large_for_stack
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|||||||
@@ -91,10 +91,12 @@ fn check_closure(cx: &LateContext, expr: &Expr) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span_lint_and_then(cx, REDUNDANT_CLOSURE, expr.span, "redundant closure found", |db| {
|
span_lint_and_then(cx,
|
||||||
if let Some(snippet) = snippet_opt(cx, caller.span) {
|
REDUNDANT_CLOSURE,
|
||||||
|
expr.span,
|
||||||
|
"redundant closure found",
|
||||||
|
|db| if let Some(snippet) = snippet_opt(cx, caller.span) {
|
||||||
db.span_suggestion(expr.span, "remove closure as shown:", snippet);
|
db.span_suggestion(expr.span, "remove closure as shown:", snippet);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -393,15 +393,13 @@ type TypedRanges = Vec<SpannedRange<ConstInt>>;
|
|||||||
/// `Uint` and `Int` probably don't make sense.
|
/// `Uint` and `Int` probably don't make sense.
|
||||||
fn type_ranges(ranges: &[SpannedRange<ConstVal>]) -> TypedRanges {
|
fn type_ranges(ranges: &[SpannedRange<ConstVal>]) -> TypedRanges {
|
||||||
ranges.iter()
|
ranges.iter()
|
||||||
.filter_map(|range| {
|
.filter_map(|range| if let (ConstVal::Integral(start), ConstVal::Integral(end)) = range.node {
|
||||||
if let (ConstVal::Integral(start), ConstVal::Integral(end)) = range.node {
|
|
||||||
Some(SpannedRange {
|
Some(SpannedRange {
|
||||||
span: range.span,
|
span: range.span,
|
||||||
node: (start, end),
|
node: (start, end),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1213,9 +1213,7 @@ fn lint_single_char_pattern(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr)
|
|||||||
SINGLE_CHAR_PATTERN,
|
SINGLE_CHAR_PATTERN,
|
||||||
arg.span,
|
arg.span,
|
||||||
"single-character string constant used as pattern",
|
"single-character string constant used as pattern",
|
||||||
|db| {
|
|db| { db.span_suggestion(expr.span, "try using a char instead:", hint); });
|
||||||
db.span_suggestion(expr.span, "try using a char instead:", hint);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,13 +351,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_nan(cx: &LateContext, path: &Path, span: Span) {
|
fn check_nan(cx: &LateContext, path: &Path, span: Span) {
|
||||||
path.segments.last().map(|seg| {
|
path.segments.last().map(|seg| if &*seg.name.as_str() == "NAN" {
|
||||||
if &*seg.name.as_str() == "NAN" {
|
|
||||||
span_lint(cx,
|
span_lint(cx,
|
||||||
CMP_NAN,
|
CMP_NAN,
|
||||||
span,
|
span,
|
||||||
"doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead");
|
"doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead");
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -276,11 +276,9 @@ impl EarlyLintPass for MiscEarly {
|
|||||||
REDUNDANT_CLOSURE_CALL,
|
REDUNDANT_CLOSURE_CALL,
|
||||||
expr.span,
|
expr.span,
|
||||||
"Try not to call a closure in the expression where it is declared.",
|
"Try not to call a closure in the expression where it is declared.",
|
||||||
|db| {
|
|db| if decl.inputs.is_empty() {
|
||||||
if decl.inputs.is_empty() {
|
|
||||||
let hint = snippet(cx, block.span, "..").into_owned();
|
let hint = snippet(cx, block.span, "..").into_owned();
|
||||||
db.span_suggestion(expr.span, "Try doing something like: ", hint);
|
db.span_suggestion(expr.span, "Try doing something like: ", hint);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,9 +74,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBool {
|
|||||||
NEEDLESS_BOOL,
|
NEEDLESS_BOOL,
|
||||||
e.span,
|
e.span,
|
||||||
"this if-then-else expression returns a bool literal",
|
"this if-then-else expression returns a bool literal",
|
||||||
|db| {
|
|db| { db.span_suggestion(e.span, "you can reduce it to", hint); });
|
||||||
db.span_suggestion(e.span, "you can reduce it to", hint);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
match (fetch_bool_block(then_block), fetch_bool_expr(else_expr)) {
|
match (fetch_bool_block(then_block), fetch_bool_expr(else_expr)) {
|
||||||
(RetBool(true), RetBool(true)) |
|
(RetBool(true), RetBool(true)) |
|
||||||
@@ -123,9 +121,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoolComparison {
|
|||||||
BOOL_COMPARISON,
|
BOOL_COMPARISON,
|
||||||
e.span,
|
e.span,
|
||||||
"equality checks against true are unnecessary",
|
"equality checks against true are unnecessary",
|
||||||
|db| {
|
|db| { db.span_suggestion(e.span, "try simplifying it as shown:", hint); });
|
||||||
db.span_suggestion(e.span, "try simplifying it as shown:", hint);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
(Other, Bool(true)) => {
|
(Other, Bool(true)) => {
|
||||||
let hint = snippet(cx, left_side.span, "..").into_owned();
|
let hint = snippet(cx, left_side.span, "..").into_owned();
|
||||||
@@ -133,9 +129,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoolComparison {
|
|||||||
BOOL_COMPARISON,
|
BOOL_COMPARISON,
|
||||||
e.span,
|
e.span,
|
||||||
"equality checks against true are unnecessary",
|
"equality checks against true are unnecessary",
|
||||||
|db| {
|
|db| { db.span_suggestion(e.span, "try simplifying it as shown:", hint); });
|
||||||
db.span_suggestion(e.span, "try simplifying it as shown:", hint);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
(Bool(false), Other) => {
|
(Bool(false), Other) => {
|
||||||
let hint = Sugg::hir(cx, right_side, "..");
|
let hint = Sugg::hir(cx, right_side, "..");
|
||||||
|
|||||||
@@ -120,9 +120,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span_lint_and_then(cx, UNNECESSARY_OPERATION, stmt.span, "statement can be reduced", |db| {
|
span_lint_and_then(cx,
|
||||||
db.span_suggestion(stmt.span, "replace it with", snippet);
|
UNNECESSARY_OPERATION,
|
||||||
});
|
stmt.span,
|
||||||
|
"statement can be reduced",
|
||||||
|
|db| { db.span_suggestion(stmt.span, "replace it with", snippet); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,10 +92,12 @@ impl ReturnPass {
|
|||||||
if in_external_macro(cx, inner_span) {
|
if in_external_macro(cx, inner_span) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| {
|
span_lint_and_then(cx,
|
||||||
if let Some(snippet) = snippet_opt(cx, inner_span) {
|
NEEDLESS_RETURN,
|
||||||
|
ret_span,
|
||||||
|
"unneeded return statement",
|
||||||
|
|db| if let Some(snippet) = snippet_opt(cx, inner_span) {
|
||||||
db.span_suggestion(ret_span, "remove `return` as shown:", snippet);
|
db.span_suggestion(ret_span, "remove `return` as shown:", snippet);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,9 +250,7 @@ fn lint_shadow<'a, 'tcx: 'a>(
|
|||||||
&format!("`{}` is shadowed by itself in `{}`",
|
&format!("`{}` is shadowed by itself in `{}`",
|
||||||
snippet(cx, pattern_span, "_"),
|
snippet(cx, pattern_span, "_"),
|
||||||
snippet(cx, expr.span, "..")),
|
snippet(cx, expr.span, "..")),
|
||||||
|db| {
|
|db| { db.span_note(prev_span, "previous binding is here"); });
|
||||||
db.span_note(prev_span, "previous binding is here");
|
|
||||||
});
|
|
||||||
} else if contains_self(cx, name, expr) {
|
} else if contains_self(cx, name, expr) {
|
||||||
span_lint_and_then(cx,
|
span_lint_and_then(cx,
|
||||||
SHADOW_REUSE,
|
SHADOW_REUSE,
|
||||||
@@ -282,9 +280,7 @@ fn lint_shadow<'a, 'tcx: 'a>(
|
|||||||
SHADOW_UNRELATED,
|
SHADOW_UNRELATED,
|
||||||
span,
|
span,
|
||||||
&format!("`{}` shadows a previous declaration", snippet(cx, pattern_span, "_")),
|
&format!("`{}` shadows a previous declaration", snippet(cx, pattern_span, "_")),
|
||||||
|db| {
|
|db| { db.span_note(prev_span, "previous binding is here"); });
|
||||||
db.span_note(prev_span, "previous binding is here");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute {
|
|||||||
USELESS_TRANSMUTE,
|
USELESS_TRANSMUTE,
|
||||||
e.span,
|
e.span,
|
||||||
"transmute from a reference to a pointer",
|
"transmute from a reference to a pointer",
|
||||||
|db| {
|
|db| if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
|
||||||
if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
|
|
||||||
let sugg = if ptr_ty == rty {
|
let sugg = if ptr_ty == rty {
|
||||||
arg.as_ty(to_ty)
|
arg.as_ty(to_ty)
|
||||||
} else {
|
} else {
|
||||||
@@ -115,7 +114,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute {
|
|||||||
};
|
};
|
||||||
|
|
||||||
db.span_suggestion(e.span, "try", sugg.to_string());
|
db.span_suggestion(e.span, "try", sugg.to_string());
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
(&ty::TyInt(_), &TyRawPtr(_)) |
|
(&ty::TyInt(_), &TyRawPtr(_)) |
|
||||||
@@ -124,10 +122,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute {
|
|||||||
USELESS_TRANSMUTE,
|
USELESS_TRANSMUTE,
|
||||||
e.span,
|
e.span,
|
||||||
"transmute from an integer to a pointer",
|
"transmute from an integer to a pointer",
|
||||||
|db| {
|
|db| if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
|
||||||
if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
|
db.span_suggestion(e.span,
|
||||||
db.span_suggestion(e.span, "try", arg.as_ty(&to_ty.to_string()).to_string());
|
"try",
|
||||||
}
|
arg.as_ty(&to_ty.to_string()).to_string());
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
(&ty::TyFloat(_), &TyRef(..)) |
|
(&ty::TyFloat(_), &TyRef(..)) |
|
||||||
|
|||||||
@@ -445,12 +445,10 @@ fn trim_multiline_inner(s: Cow<str>, ignore_first: bool, ch: char) -> Cow<str> {
|
|||||||
if x > 0 {
|
if x > 0 {
|
||||||
Cow::Owned(s.lines()
|
Cow::Owned(s.lines()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, l)| {
|
.map(|(i, l)| if (ignore_first && i == 0) || l.is_empty() {
|
||||||
if (ignore_first && i == 0) || l.is_empty() {
|
|
||||||
l
|
l
|
||||||
} else {
|
} else {
|
||||||
l.split_at(x).1
|
l.split_at(x).1
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join("\n"))
|
.join("\n"))
|
||||||
@@ -467,12 +465,10 @@ pub fn get_parent_expr<'c>(cx: &'c LateContext, e: &Expr) -> Option<&'c Expr> {
|
|||||||
if node_id == parent_id {
|
if node_id == parent_id {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
map.find(parent_id).and_then(|node| {
|
map.find(parent_id).and_then(|node| if let Node::NodeExpr(parent) = node {
|
||||||
if let Node::NodeExpr(parent) = node {
|
|
||||||
Some(parent)
|
Some(parent)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,8 +258,9 @@ pub fn make_assoc(op: AssocOp, lhs: &Sugg, rhs: &Sugg) -> Sugg<'static> {
|
|||||||
fn needs_paren(op: &AssocOp, other: &AssocOp, dir: Associativity) -> bool {
|
fn needs_paren(op: &AssocOp, other: &AssocOp, dir: Associativity) -> bool {
|
||||||
other.precedence() < op.precedence() ||
|
other.precedence() < op.precedence() ||
|
||||||
(other.precedence() == op.precedence() &&
|
(other.precedence() == op.precedence() &&
|
||||||
((op != other && associativity(op) != dir) || (op == other && associativity(op) != Associativity::Both))) ||
|
((op != other && associativity(op) != dir) ||
|
||||||
is_shift(op) && is_arith(other) || is_shift(other) && is_arith(op)
|
(op == other && associativity(op) != Associativity::Both))) || is_shift(op) && is_arith(other) ||
|
||||||
|
is_shift(other) && is_arith(op)
|
||||||
}
|
}
|
||||||
|
|
||||||
let lhs_paren = if let Sugg::BinOp(ref lop, _) = *lhs {
|
let lhs_paren = if let Sugg::BinOp(ref lop, _) = *lhs {
|
||||||
@@ -433,13 +434,11 @@ impl<'a, 'b, 'c, T: LintContext<'c>> DiagnosticBuilderExt<'c, T> for rustc_error
|
|||||||
|
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
let new_item = new_item.lines()
|
let new_item = new_item.lines()
|
||||||
.map(|l| {
|
.map(|l| if first {
|
||||||
if first {
|
|
||||||
first = false;
|
first = false;
|
||||||
format!("{}\n", l)
|
format!("{}\n", l)
|
||||||
} else {
|
} else {
|
||||||
format!("{}{}\n", indent, l)
|
format!("{}{}\n", indent, l)
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
|
|
||||||
|
|||||||
@@ -81,9 +81,11 @@ fn check_vec_macro(cx: &LateContext, vec_args: &higher::VecArgs, span: Span) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
span_lint_and_then(cx, USELESS_VEC, span, "useless use of `vec!`", |db| {
|
span_lint_and_then(cx,
|
||||||
db.span_suggestion(span, "you can use a slice directly", snippet);
|
USELESS_VEC,
|
||||||
});
|
span,
|
||||||
|
"useless use of `vec!`",
|
||||||
|
|db| { db.span_suggestion(span, "you can use a slice directly", snippet); });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the item type of the vector (ie. the `T` in `Vec<T>`).
|
/// Return the item type of the vector (ie. the `T` in `Vec<T>`).
|
||||||
|
|||||||
Reference in New Issue
Block a user