mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
slighty simplify a few boolean expressions (clippy::nonminimal_bool)
This commit is contained in:
parent
5a07e33d2c
commit
73bd953dea
@ -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",
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user