Auto merge of #90668 - matthiaskrgr:clippy_nov7, r=jyn514
more clippy fixes
This commit is contained in:
commit
46b8e7488e
27 changed files with 140 additions and 184 deletions
|
@ -3130,18 +3130,13 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
|
|||
false
|
||||
}
|
||||
|
||||
if let rustc_hir::ExprKind::Unary(ref un_op, ref expr_deref) = expr.kind {
|
||||
if let rustc_hir::UnOp::Deref = un_op {
|
||||
if is_null_ptr(cx, expr_deref) {
|
||||
cx.struct_span_lint(DEREF_NULLPTR, expr.span, |lint| {
|
||||
let mut err = lint.build("dereferencing a null pointer");
|
||||
err.span_label(
|
||||
expr.span,
|
||||
"this code causes undefined behavior when executed",
|
||||
);
|
||||
err.emit();
|
||||
});
|
||||
}
|
||||
if let rustc_hir::ExprKind::Unary(rustc_hir::UnOp::Deref, expr_deref) = expr.kind {
|
||||
if is_null_ptr(cx, expr_deref) {
|
||||
cx.struct_span_lint(DEREF_NULLPTR, expr.span, |lint| {
|
||||
let mut err = lint.build("dereferencing a null pointer");
|
||||
err.span_label(expr.span, "this code causes undefined behavior when executed");
|
||||
err.emit();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3196,7 +3191,7 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
|
|||
let snippet = template_snippet.as_str();
|
||||
if let Some(pos) = snippet.find(needle) {
|
||||
let end = pos
|
||||
+ &snippet[pos..]
|
||||
+ snippet[pos..]
|
||||
.find(|c| c == ':')
|
||||
.unwrap_or(snippet[pos..].len() - 1);
|
||||
let inner = InnerSpan::new(pos, end);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue