Skip to content

Commit 87284d7

Browse files
authored
Rollup merge of #69569 - matthiaskrgr:nonminimal_bool, r=mark-Simulacrum
simplify boolean expressions
2 parents 55d0a8b + 56a3da3 commit 87284d7

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

src/liballoc/collections/binary_heap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ impl<T: Ord> BinaryHeap<T> {
536536
while child < end {
537537
let right = child + 1;
538538
// compare with the greater of the two children
539-
if right < end && !(hole.get(child) > hole.get(right)) {
539+
if right < end && hole.get(child) <= hole.get(right) {
540540
child = right;
541541
}
542542
// if we are already in order, stop.
@@ -568,7 +568,7 @@ impl<T: Ord> BinaryHeap<T> {
568568
while child < end {
569569
let right = child + 1;
570570
// compare with the greater of the two children
571-
if right < end && !(hole.get(child) > hole.get(right)) {
571+
if right < end && hole.get(child) <= hole.get(right) {
572572
child = right;
573573
}
574574
hole.move_to(child);

src/librustc_codegen_llvm/debuginfo/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ fn set_members_of_composite_type(
21352135
/// Computes the type parameters for a type, if any, for the given metadata.
21362136
fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> Option<&'ll DIArray> {
21372137
if let ty::Adt(def, substs) = ty.kind {
2138-
if !substs.types().next().is_none() {
2138+
if substs.types().next().is_some() {
21392139
let generics = cx.tcx.generics_of(def.did);
21402140
let names = get_parameter_names(cx, generics);
21412141
let template_params: Vec<_> = substs

src/librustc_codegen_ssa/mir/debuginfo.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct DebugScope<D> {
4848

4949
impl<D> DebugScope<D> {
5050
pub fn is_valid(&self) -> bool {
51-
!self.scope_metadata.is_none()
51+
self.scope_metadata.is_some()
5252
}
5353
}
5454

@@ -304,7 +304,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
304304
) -> Option<IndexVec<mir::Local, Vec<PerLocalVarDebugInfo<'tcx, Bx::DIVariable>>>> {
305305
let full_debug_info = self.cx.sess().opts.debuginfo == DebugInfo::Full;
306306

307-
if !(full_debug_info || !self.cx.sess().fewer_names()) {
307+
if !full_debug_info && self.cx.sess().fewer_names() {
308308
return None;
309309
}
310310

src/librustc_infer/infer/freshen.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
143143
}
144144

145145
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
146-
if !t.needs_infer()
147-
&& !t.has_erasable_regions()
148-
&& !(t.has_closure_types() && self.infcx.in_progress_tables.is_some())
146+
if !(t.needs_infer()
147+
|| t.has_erasable_regions()
148+
|| (t.has_closure_types() && self.infcx.in_progress_tables.is_some()))
149149
{
150150
return t;
151151
}

src/librustc_infer/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14841484

14851485
// Even if the type may have no inference variables, during
14861486
// type-checking closure types are in local tables only.
1487-
if !self.in_progress_tables.is_some() || !ty.has_closure_types() {
1487+
if self.in_progress_tables.is_none() || !ty.has_closure_types() {
14881488
if !(param_env, ty).has_local_value() {
14891489
return ty.is_copy_modulo_regions(self.tcx, param_env, span);
14901490
}

src/librustc_passes/stability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ impl Visitor<'tcx> for Checker<'tcx> {
551551
.emit();
552552
} else {
553553
let param_env = self.tcx.param_env(def_id);
554-
if !can_type_implement_copy(self.tcx, param_env, ty).is_ok() {
554+
if can_type_implement_copy(self.tcx, param_env, ty).is_err() {
555555
feature_err(
556556
&self.tcx.sess.parse_sess,
557557
sym::untagged_unions,

src/librustc_resolve/imports.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ impl<'a> Resolver<'a> {
313313
}
314314
}
315315

316-
if !self.is_accessible_from(binding.vis, parent_scope.module) &&
316+
if !(self.is_accessible_from(binding.vis, parent_scope.module) ||
317317
// Remove this together with `PUB_USE_OF_PRIVATE_EXTERN_CRATE`
318-
!(self.last_import_segment && binding.is_extern_crate())
318+
(self.last_import_segment && binding.is_extern_crate()))
319319
{
320320
self.privacy_errors.push(PrivacyError {
321321
ident,

src/libstd/net/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl<'a> Parser<'a> {
206206
}
207207

208208
// read `::` if previous code parsed less than 8 groups
209-
if !self.read_given_char(':').is_some() || !self.read_given_char(':').is_some() {
209+
if self.read_given_char(':').is_none() || self.read_given_char(':').is_none() {
210210
return None;
211211
}
212212

0 commit comments

Comments
 (0)