Skip to content

Commit

Permalink
Stop returning a value from report_assert_as_lint
Browse files Browse the repository at this point in the history
This function only ever returns `None`. Make that explicity by not returning a value at all.
  • Loading branch information
LingMan committed Jun 15, 2021
1 parent 607d6b0 commit e42d5ee
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions compiler/rustc_mir/src/transform/const_prop.rs
Expand Up @@ -528,14 +528,14 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
source_info: SourceInfo,
message: &'static str,
panic: AssertKind<impl std::fmt::Debug>,
) -> Option<()> {
let lint_root = self.lint_root(source_info)?;
self.tcx.struct_span_lint_hir(lint, lint_root, source_info.span, |lint| {
let mut err = lint.build(message);
err.span_label(source_info.span, format!("{:?}", panic));
err.emit()
});
None
) {
if let Some(lint_root) = self.lint_root(source_info) {
self.tcx.struct_span_lint_hir(lint, lint_root, source_info.span, |lint| {
let mut err = lint.build(message);
err.span_label(source_info.span, format!("{:?}", panic));
err.emit()
});
}
}

fn check_unary_op(
Expand All @@ -557,7 +557,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
source_info,
"this arithmetic operation will overflow",
AssertKind::OverflowNeg(val.to_const_int()),
)?;
);
return None;
}

Some(())
Expand Down Expand Up @@ -602,7 +603,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
},
r.to_const_int(),
),
)?;
);
return None;
}
}

Expand All @@ -617,7 +619,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
source_info,
"this arithmetic operation will overflow",
AssertKind::Overflow(op, l.to_const_int(), r.to_const_int()),
)?;
);
return None;
}
}
Some(())
Expand Down

0 comments on commit e42d5ee

Please sign in to comment.