slighty simplify a few boolean expressions (clippy::nonminimal_bool)

This commit is contained in:
Matthias Krüger 2023-04-01 23:55:22 +02:00
parent 5a07e33d2c
commit 73bd953dea
4 changed files with 4 additions and 5 deletions

View File

@ -677,8 +677,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
);
}
if let Rvalue::CopyForDeref(place) = rvalue {
if !place.ty(&self.body.local_decls, self.tcx).ty.builtin_deref(true).is_some()
{
if place.ty(&self.body.local_decls, self.tcx).ty.builtin_deref(true).is_none() {
self.fail(
location,
"`CopyForDeref` should only be used for dereferenceable types",

View File

@ -559,7 +559,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
// struct; however, when EUV is run during typeck, it
// may not. This will generate an error earlier in typeck,
// so we can just ignore it.
if !self.tcx().sess.has_errors().is_some() {
if self.tcx().sess.has_errors().is_none() {
span_bug!(with_expr.span, "with expression doesn't evaluate to a struct");
}
}

View File

@ -206,7 +206,7 @@ fn no_main_err(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) {
// The file may be empty, which leads to the diagnostic machinery not emitting this
// note. This is a relatively simple way to detect that case and emit a span-less
// note instead.
let file_empty = !tcx.sess.source_map().lookup_line(sp.hi()).is_ok();
let file_empty = tcx.sess.source_map().lookup_line(sp.hi()).is_err();
tcx.sess.emit_err(NoMainErr {
sp,

View File

@ -389,7 +389,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}
}
assert!(force || !finalize.is_some()); // `finalize` implies `force`
assert!(force || finalize.is_none()); // `finalize` implies `force`
// Make sure `self`, `super` etc produce an error when passed to here.
if orig_ident.is_path_segment_keyword() {