Use iter::zip in compiler/
This commit is contained in:
parent
3b1f5e3462
commit
72ebebe474
87 changed files with 213 additions and 204 deletions
|
@ -45,6 +45,7 @@ use rustc_target::abi::LayoutOf;
|
|||
use tracing::debug;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::iter;
|
||||
use std::slice;
|
||||
|
||||
/// Information about the registered lints.
|
||||
|
@ -864,7 +865,7 @@ impl<'tcx> LateContext<'tcx> {
|
|||
pub fn match_def_path(&self, def_id: DefId, path: &[Symbol]) -> bool {
|
||||
let names = self.get_def_path(def_id);
|
||||
|
||||
names.len() == path.len() && names.into_iter().zip(path.iter()).all(|(a, &b)| a == b)
|
||||
names.len() == path.len() && iter::zip(names, path).all(|(a, &b)| a == b)
|
||||
}
|
||||
|
||||
/// Gets the absolute path of `def_id` as a vector of `Symbol`.
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#![feature(box_patterns)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(iter_order_by)]
|
||||
#![feature(iter_zip)]
|
||||
#![feature(never_type)]
|
||||
#![feature(nll)]
|
||||
#![cfg_attr(bootstrap, feature(or_patterns))]
|
||||
|
|
|
@ -17,6 +17,7 @@ use rustc_target::abi::{Integer, LayoutOf, TagEncoding, VariantIdx, Variants};
|
|||
use rustc_target::spec::abi::Abi as SpecAbi;
|
||||
|
||||
use std::cmp;
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
use tracing::debug;
|
||||
|
||||
|
@ -1255,7 +1256,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
let sig = self.cx.tcx.fn_sig(def_id);
|
||||
let sig = self.cx.tcx.erase_late_bound_regions(sig);
|
||||
|
||||
for (input_ty, input_hir) in sig.inputs().iter().zip(decl.inputs) {
|
||||
for (input_ty, input_hir) in iter::zip(sig.inputs(), decl.inputs) {
|
||||
self.check_type_for_ffi_and_report_errors(input_hir.span, input_ty, false, false);
|
||||
}
|
||||
|
||||
|
@ -1355,10 +1356,7 @@ impl<'tcx> LateLintPass<'tcx> for VariantSizeDifferences {
|
|||
layout
|
||||
);
|
||||
|
||||
let (largest, slargest, largest_index) = enum_definition
|
||||
.variants
|
||||
.iter()
|
||||
.zip(variants)
|
||||
let (largest, slargest, largest_index) = iter::zip(enum_definition.variants, variants)
|
||||
.map(|(variant, variant_layout)| {
|
||||
// Subtract the size of the enum tag.
|
||||
let bytes = variant_layout.size.bytes().saturating_sub(tag_size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue