}
let suggestions = assignments
- .into_iter()
- .map(|assignment| Some((assignment.span, snippet_opt(cx, assignment.rhs_span)?)))
+ .iter()
+ .map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new())))
+ .chain(assignments.iter().map(|assignment| {
+ Some((
+ assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()),
+ String::new(),
+ ))
+ }))
.collect::<Option<Vec<(Span, String)>>>()?;
let applicability = if suggestions.len() > 1 {
Some(())
}
-impl LateLintPass<'tcx> for NeedlessLateInit {
+impl<'tcx> LateLintPass<'tcx> for NeedlessLateInit {
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
let mut parents = cx.tcx.hir().parent_iter(local.hir_id);