[meta] Refactor itertools::{chain,enumerate,repeat_n} with std equiv
This commit is contained in:
parent
1531b6cc98
commit
08b717d640
@ -11,7 +11,7 @@ use inkwell::{
|
||||
values::{BasicValueEnum, CallSiteValue, FunctionValue, IntValue, PointerValue, StructValue},
|
||||
AddressSpace, IntPredicate, OptimizationLevel,
|
||||
};
|
||||
use itertools::{chain, izip, Either, Itertools};
|
||||
use itertools::{izip, Either, Itertools};
|
||||
|
||||
use nac3parser::ast::{
|
||||
self, Boolop, Cmpop, Comprehension, Constant, Expr, ExprKind, Location, Operator, StrRef,
|
||||
@ -1965,7 +1965,7 @@ pub fn gen_cmpop_expr_with_values<'ctx, G: CodeGenerator>(
|
||||
}
|
||||
}
|
||||
|
||||
let cmp_val = izip!(chain(once(&left), comparators.iter()), comparators.iter(), ops.iter(),)
|
||||
let cmp_val = izip!(once(&left).chain(comparators.iter()), comparators.iter(), ops.iter(),)
|
||||
.fold(Ok(None), |prev: Result<Option<_>, String>, (lhs, rhs, op)| {
|
||||
let (left_ty, lhs) = lhs;
|
||||
let (right_ty, rhs) = rhs;
|
||||
|
@ -6,7 +6,7 @@ use std::{
|
||||
};
|
||||
|
||||
use inkwell::values::{BasicValueEnum, FloatValue, IntValue, PointerValue, StructValue};
|
||||
use itertools::{chain, izip, Itertools};
|
||||
use itertools::{izip, Itertools};
|
||||
use parking_lot::RwLock;
|
||||
|
||||
use nac3parser::ast::{Constant, Expr, Location, StrRef};
|
||||
@ -452,11 +452,11 @@ pub fn parse_type_annotation<T>(
|
||||
type_vars.len()
|
||||
)]));
|
||||
}
|
||||
let fields = chain(
|
||||
fields.iter().map(|(k, v, m)| (*k, (*v, *m))),
|
||||
methods.iter().map(|(k, v, _)| (*k, (*v, false))),
|
||||
)
|
||||
.collect();
|
||||
let fields = fields
|
||||
.iter()
|
||||
.map(|(k, v, m)| (*k, (*v, *m)))
|
||||
.chain(methods.iter().map(|(k, v, _)| (*k, (*v, false))))
|
||||
.collect();
|
||||
Ok(unifier.add_ty(TypeEnum::TObj { obj_id, fields, params: VarMap::default() }))
|
||||
} else {
|
||||
Err(HashSet::from([format!("Cannot use function name as type at {loc}")]))
|
||||
|
@ -1052,7 +1052,7 @@ impl TopLevelComposer {
|
||||
}
|
||||
let mut result = Vec::new();
|
||||
let no_defaults = args.args.len() - args.defaults.len() - 1;
|
||||
for (idx, x) in itertools::enumerate(args.args.iter().skip(1)) {
|
||||
for (idx, x) in args.args.iter().skip(1).enumerate() {
|
||||
let type_ann = {
|
||||
let Some(annotation_expr) = x.node.annotation.as_ref() else {return Err(HashSet::from([format!("type annotation needed for `{}` (at {})", x.node.arg, x.location)]));};
|
||||
parse_ast_to_type_annotation_kinds(
|
||||
|
@ -3,13 +3,13 @@ use std::{
|
||||
cell::RefCell,
|
||||
collections::{HashMap, HashSet},
|
||||
fmt::{self, Display},
|
||||
iter::{repeat, zip},
|
||||
iter::{repeat, repeat_n, zip},
|
||||
rc::Rc,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use itertools::{repeat_n, Itertools};
|
||||
use itertools::Itertools;
|
||||
|
||||
use nac3parser::ast::{Cmpop, Location, StrRef, Unaryop};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user