diff --git a/compiler/rustc_const_eval/src/interpret/visitor.rs b/compiler/rustc_const_eval/src/interpret/visitor.rs index fc21ad1f1834b..32f35933bbf78 100644 --- a/compiler/rustc_const_eval/src/interpret/visitor.rs +++ b/compiler/rustc_const_eval/src/interpret/visitor.rs @@ -21,7 +21,7 @@ pub trait ValueVisitor<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>: Sized { /// `read_discriminant` can be hooked for better error messages. #[inline(always)] fn read_discriminant(&mut self, v: &Self::V) -> InterpResult<'tcx, VariantIdx> { - Ok(self.ecx().read_discriminant(&v.to_op(self.ecx())?)?) + self.ecx().read_discriminant(&v.to_op(self.ecx())?) } /// This function provides the chance to reorder the order in which fields are visited for diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 65c7aed3f1078..44f414dc49994 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -600,10 +600,8 @@ fn show_md_content_with_pager(content: &str, color: ColorConfig) { let mut print_formatted = if pager_name == "less" { cmd.arg("-r"); true - } else if ["bat", "catbat", "delta"].iter().any(|v| *v == pager_name) { - true } else { - false + ["bat", "catbat", "delta"].iter().any(|v| *v == pager_name) }; if color == ColorConfig::Never { diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index fcf46be6e6f5a..5aedc37adc9f5 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -69,7 +69,7 @@ const DEP_NODE_PAD: usize = DEP_NODE_SIZE - 1; const DEP_NODE_WIDTH_BITS: usize = DEP_NODE_SIZE / 2; /// Data for use when recompiling the **current crate**. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct SerializedDepGraph { /// The set of all DepNodes in the graph nodes: IndexVec, @@ -88,18 +88,6 @@ pub struct SerializedDepGraph { index: Vec>, } -impl Default for SerializedDepGraph { - fn default() -> Self { - SerializedDepGraph { - nodes: Default::default(), - fingerprints: Default::default(), - edge_list_indices: Default::default(), - edge_list_data: Default::default(), - index: Default::default(), - } - } -} - impl SerializedDepGraph { #[inline] pub fn edge_targets_from( diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index d271519a8a385..bd0d08a9df93f 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -1048,12 +1048,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { initial_binding.res() }); let res = binding.res(); - let has_ambiguity_error = this - .ambiguity_errors - .iter() - .filter(|error| !error.warning) - .next() - .is_some(); + let has_ambiguity_error = + this.ambiguity_errors.iter().any(|error| !error.warning); if res == Res::Err || has_ambiguity_error { this.tcx .sess diff --git a/compiler/rustc_ty_utils/src/needs_drop.rs b/compiler/rustc_ty_utils/src/needs_drop.rs index 6dcbc4470e607..ad7a52d8c4700 100644 --- a/compiler/rustc_ty_utils/src/needs_drop.rs +++ b/compiler/rustc_ty_utils/src/needs_drop.rs @@ -20,8 +20,7 @@ fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx> let adt_has_dtor = |adt_def: ty::AdtDef<'tcx>| adt_def.destructor(tcx).map(|_| DtorType::Significant); let res = drop_tys_helper(tcx, query.value, query.param_env, adt_has_dtor, false) - .filter(filter_array_elements(tcx, query.param_env)) - .next() + .find(filter_array_elements(tcx, query.param_env)) .is_some(); debug!("needs_drop_raw({:?}) = {:?}", query, res); @@ -56,8 +55,7 @@ fn has_significant_drop_raw<'tcx>( adt_consider_insignificant_dtor(tcx), true, ) - .filter(filter_array_elements(tcx, query.param_env)) - .next() + .find(filter_array_elements(tcx, query.param_env)) .is_some(); debug!("has_significant_drop_raw({:?}) = {:?}", query, res); res diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 34d81f51f76e6..5350489305258 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1589,7 +1589,7 @@ fn first_non_private<'tcx>( path: &hir::Path<'tcx>, ) -> Option { let target_def_id = path.res.opt_def_id()?; - let (parent_def_id, ident) = match &path.segments[..] { + let (parent_def_id, ident) = match &path.segments { [] => return None, // Relative paths are available in the same scope as the owner. [leaf] => (cx.tcx.local_parent(hir_id.owner.def_id), leaf.ident), diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 8388f722a7f1a..2a74f3b86580c 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -498,7 +498,7 @@ pub(crate) fn has_doc_flag(tcx: TyCtxt<'_>, did: DefId, flag: Symbol) -> bool { /// Set by `bootstrap::Builder::doc_rust_lang_org_channel` in order to keep tests passing on beta/stable. pub(crate) const DOC_RUST_LANG_ORG_CHANNEL: &str = env!("DOC_RUST_LANG_ORG_CHANNEL"); pub(crate) static DOC_CHANNEL: Lazy<&'static str> = - Lazy::new(|| DOC_RUST_LANG_ORG_CHANNEL.rsplit("/").filter(|c| !c.is_empty()).next().unwrap()); + Lazy::new(|| DOC_RUST_LANG_ORG_CHANNEL.rsplit("/").find(|c| !c.is_empty()).unwrap()); /// Render a sequence of macro arms in a format suitable for displaying to the user /// as part of an item declaration.