diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2020-02-29 01:56:37 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2020-02-29 11:36:18 +0100 |
| commit | 56a3da3bd0e2f6b5963913e998c74266cf7cff7b (patch) | |
| tree | 7f962fdd09085c6b5007964e623de9dcd4f1d00e | |
| parent | 0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb (diff) | |
| download | rust-56a3da3bd0e2f6b5963913e998c74266cf7cff7b.tar.gz rust-56a3da3bd0e2f6b5963913e998c74266cf7cff7b.zip | |
simplify boolean expressions
| -rw-r--r-- | src/liballoc/collections/binary_heap.rs | 4 | ||||
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/metadata.rs | 2 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/mir/debuginfo.rs | 4 | ||||
| -rw-r--r-- | src/librustc_infer/infer/freshen.rs | 6 | ||||
| -rw-r--r-- | src/librustc_infer/infer/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc_passes/stability.rs | 2 | ||||
| -rw-r--r-- | src/librustc_resolve/imports.rs | 4 | ||||
| -rw-r--r-- | src/libstd/net/parser.rs | 2 |
8 files changed, 13 insertions, 13 deletions
diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index f38fe997b73..9908a304976 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -536,7 +536,7 @@ impl<T: Ord> BinaryHeap<T> { while child < end { let right = child + 1; // compare with the greater of the two children - if right < end && !(hole.get(child) > hole.get(right)) { + if right < end && hole.get(child) <= hole.get(right) { child = right; } // if we are already in order, stop. @@ -568,7 +568,7 @@ impl<T: Ord> BinaryHeap<T> { while child < end { let right = child + 1; // compare with the greater of the two children - if right < end && !(hole.get(child) > hole.get(right)) { + if right < end && hole.get(child) <= hole.get(right) { child = right; } hole.move_to(child); diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index d1f70ad43bd..ab024a02650 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -2135,7 +2135,7 @@ fn set_members_of_composite_type( /// Computes the type parameters for a type, if any, for the given metadata. fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> Option<&'ll DIArray> { if let ty::Adt(def, substs) = ty.kind { - if !substs.types().next().is_none() { + if substs.types().next().is_some() { let generics = cx.tcx.generics_of(def.did); let names = get_parameter_names(cx, generics); let template_params: Vec<_> = substs diff --git a/src/librustc_codegen_ssa/mir/debuginfo.rs b/src/librustc_codegen_ssa/mir/debuginfo.rs index e5f21013ce3..2dc1405f4e4 100644 --- a/src/librustc_codegen_ssa/mir/debuginfo.rs +++ b/src/librustc_codegen_ssa/mir/debuginfo.rs @@ -48,7 +48,7 @@ pub struct DebugScope<D> { impl<D> DebugScope<D> { pub fn is_valid(&self) -> bool { - !self.scope_metadata.is_none() + self.scope_metadata.is_some() } } @@ -304,7 +304,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ) -> Option<IndexVec<mir::Local, Vec<PerLocalVarDebugInfo<'tcx, Bx::DIVariable>>>> { let full_debug_info = self.cx.sess().opts.debuginfo == DebugInfo::Full; - if !(full_debug_info || !self.cx.sess().fewer_names()) { + if !full_debug_info && self.cx.sess().fewer_names() { return None; } diff --git a/src/librustc_infer/infer/freshen.rs b/src/librustc_infer/infer/freshen.rs index 63dded3b43d..f7141c56199 100644 --- a/src/librustc_infer/infer/freshen.rs +++ b/src/librustc_infer/infer/freshen.rs @@ -143,9 +143,9 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> { } fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> { - if !t.needs_infer() - && !t.has_erasable_regions() - && !(t.has_closure_types() && self.infcx.in_progress_tables.is_some()) + if !(t.needs_infer() + || t.has_erasable_regions() + || (t.has_closure_types() && self.infcx.in_progress_tables.is_some())) { return t; } diff --git a/src/librustc_infer/infer/mod.rs b/src/librustc_infer/infer/mod.rs index 26998f0a33c..766de569132 100644 --- a/src/librustc_infer/infer/mod.rs +++ b/src/librustc_infer/infer/mod.rs @@ -1484,7 +1484,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { // Even if the type may have no inference variables, during // type-checking closure types are in local tables only. - if !self.in_progress_tables.is_some() || !ty.has_closure_types() { + if self.in_progress_tables.is_none() || !ty.has_closure_types() { if !(param_env, ty).has_local_value() { return ty.is_copy_modulo_regions(self.tcx, param_env, span); } diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs index 99fbac4568e..bab468493df 100644 --- a/src/librustc_passes/stability.rs +++ b/src/librustc_passes/stability.rs @@ -551,7 +551,7 @@ impl Visitor<'tcx> for Checker<'tcx> { .emit(); } else { let param_env = self.tcx.param_env(def_id); - if !can_type_implement_copy(self.tcx, param_env, ty).is_ok() { + if can_type_implement_copy(self.tcx, param_env, ty).is_err() { feature_err( &self.tcx.sess.parse_sess, sym::untagged_unions, diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index 55ce51e0ff0..8a07a6fe8c9 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -313,9 +313,9 @@ impl<'a> Resolver<'a> { } } - if !self.is_accessible_from(binding.vis, parent_scope.module) && + if !(self.is_accessible_from(binding.vis, parent_scope.module) || // Remove this together with `PUB_USE_OF_PRIVATE_EXTERN_CRATE` - !(self.last_import_segment && binding.is_extern_crate()) + (self.last_import_segment && binding.is_extern_crate())) { self.privacy_errors.push(PrivacyError { ident, diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs index 868a7e261c4..3f38ee54710 100644 --- a/src/libstd/net/parser.rs +++ b/src/libstd/net/parser.rs @@ -206,7 +206,7 @@ impl<'a> Parser<'a> { } // read `::` if previous code parsed less than 8 groups - if !self.read_given_char(':').is_some() || !self.read_given_char(':').is_some() { + if self.read_given_char(':').is_none() || self.read_given_char(':').is_none() { return None; } |
