Skip to content

Commit 73bd953

Browse files
committed
slighty simplify a few boolean expressions (clippy::nonminimal_bool)
1 parent 5a07e33 commit 73bd953

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

compiler/rustc_const_eval/src/transform/validate.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
677677
);
678678
}
679679
if let Rvalue::CopyForDeref(place) = rvalue {
680-
if !place.ty(&self.body.local_decls, self.tcx).ty.builtin_deref(true).is_some()
681-
{
680+
if place.ty(&self.body.local_decls, self.tcx).ty.builtin_deref(true).is_none() {
682681
self.fail(
683682
location,
684683
"`CopyForDeref` should only be used for dereferenceable types",

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

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

compiler/rustc_passes/src/entry.rs

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

211211
tcx.sess.emit_err(NoMainErr {
212212
sp,

compiler/rustc_resolve/src/ident.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
389389
}
390390
}
391391

392-
assert!(force || !finalize.is_some()); // `finalize` implies `force`
392+
assert!(force || finalize.is_none()); // `finalize` implies `force`
393393

394394
// Make sure `self`, `super` etc produce an error when passed to here.
395395
if orig_ident.is_path_segment_keyword() {

0 commit comments

Comments
 (0)