diff --git a/crates/aiken-lang/src/gen_uplc.rs b/crates/aiken-lang/src/gen_uplc.rs index 26004468..7f02f5b0 100644 --- a/crates/aiken-lang/src/gen_uplc.rs +++ b/crates/aiken-lang/src/gen_uplc.rs @@ -928,7 +928,7 @@ impl<'a> CodeGenerator<'a> { let list_elem_types = tipo.get_inner_types(); let list_elem_type = list_elem_types - .get(0) + .first() .unwrap_or_else(|| unreachable!("No list element type?")); let mut elems = elements @@ -2172,7 +2172,7 @@ impl<'a> CodeGenerator<'a> { let list_elem_types = subject_tipo.get_inner_types(); let list_elem_type = list_elem_types - .get(0) + .first() .unwrap_or_else(|| unreachable!("No list element type?")); let defined_tails = defined_tails.clone(); @@ -3862,7 +3862,7 @@ impl<'a> CodeGenerator<'a> { if constr_type.arguments.is_empty() { term = Term::constr_data() - .apply(Term::integer(constr_index.try_into().unwrap())) + .apply(Term::integer(constr_index.into())) .apply(term); let mut program: Program = Program { diff --git a/crates/aiken-lang/src/gen_uplc/builder.rs b/crates/aiken-lang/src/gen_uplc/builder.rs index e44223a0..4c93355e 100644 --- a/crates/aiken-lang/src/gen_uplc/builder.rs +++ b/crates/aiken-lang/src/gen_uplc/builder.rs @@ -1256,11 +1256,11 @@ pub fn convert_constants_to_data(constants: Vec>) -> Vec UplcConstant::Data(PlutusData::BigInt(to_pallas_bigint(i))), UplcConstant::ByteString(b) => { - UplcConstant::Data(PlutusData::BoundedBytes(b.clone().try_into().unwrap())) + UplcConstant::Data(PlutusData::BoundedBytes(b.clone().into())) + } + UplcConstant::String(s) => { + UplcConstant::Data(PlutusData::BoundedBytes(s.as_bytes().to_vec().into())) } - UplcConstant::String(s) => UplcConstant::Data(PlutusData::BoundedBytes( - s.as_bytes().to_vec().try_into().unwrap(), - )), UplcConstant::Bool(b) => UplcConstant::Data(PlutusData::Constr(Constr { tag: convert_constr_to_tag((*b).into()).unwrap_or(ANY_TAG), diff --git a/crates/aiken-lang/src/tipo/environment.rs b/crates/aiken-lang/src/tipo/environment.rs index a96715b5..8aa487f1 100644 --- a/crates/aiken-lang/src/tipo/environment.rs +++ b/crates/aiken-lang/src/tipo/environment.rs @@ -1767,7 +1767,7 @@ fn get_compatible_record_fields( return compatible; } - let first = match constructors.get(0) { + let first = match constructors.first() { Some(first) => first, None => return compatible, }; diff --git a/crates/aiken-lang/src/tipo/pattern.rs b/crates/aiken-lang/src/tipo/pattern.rs index 5c87bce3..597edf3e 100644 --- a/crates/aiken-lang/src/tipo/pattern.rs +++ b/crates/aiken-lang/src/tipo/pattern.rs @@ -207,7 +207,7 @@ impl<'a, 'b> PatternTyper<'a, 'b> { } => match tipo.get_app_args(true, "", "List", 1, self.environment) { Some(args) => { let tipo = args - .get(0) + .first() .expect("Failed to get type argument of List") .clone(); diff --git a/crates/aiken-lang/src/tipo/pipe.rs b/crates/aiken-lang/src/tipo/pipe.rs index a1b552f5..d615cc85 100644 --- a/crates/aiken-lang/src/tipo/pipe.rs +++ b/crates/aiken-lang/src/tipo/pipe.rs @@ -263,7 +263,7 @@ impl<'a, 'b, 'c> PipeTyper<'a, 'b, 'c> { function(vec![self.argument_type.clone()], return_type.clone()), func.location(), if let Type::Fn { args, .. } = func.tipo().deref() { - if let Some(typ) = args.get(0) { + if let Some(typ) = args.first() { typ.is_data() } else { false @@ -300,7 +300,7 @@ impl<'a, 'b, 'c> PipeTyper<'a, 'b, 'c> { match types { (Type::Fn { args: a, .. }, Type::Fn { args: b, .. }) if a.len() == b.len() => { - match (a.get(0), b.get(0)) { + match (a.first(), b.first()) { (Some(a), Some(b)) => self .expr_typer .environment diff --git a/crates/aiken-project/src/blueprint/schema.rs b/crates/aiken-project/src/blueprint/schema.rs index aa7f8a45..f07e02e7 100644 --- a/crates/aiken-project/src/blueprint/schema.rs +++ b/crates/aiken-project/src/blueprint/schema.rs @@ -250,7 +250,7 @@ impl Annotated { "Option" => { let generic = Annotated::do_from_type( - args.get(0) + args.first() .expect("Option types have always one generic argument"), modules, type_parameters, @@ -283,7 +283,7 @@ impl Annotated { "List" => { let generic = Annotated::do_from_type( - args.get(0) + args.first() .expect("List types have always one generic argument"), modules, type_parameters, diff --git a/crates/uplc/src/machine/runtime.rs b/crates/uplc/src/machine/runtime.rs index 8ae2e292..ad1ee382 100644 --- a/crates/uplc/src/machine/runtime.rs +++ b/crates/uplc/src/machine/runtime.rs @@ -820,7 +820,7 @@ impl DefaultFunction { DefaultFunction::BData => { let b = args[0].unwrap_byte_string()?; - let value = Value::data(PlutusData::BoundedBytes(b.clone().try_into().unwrap())); + let value = Value::data(PlutusData::BoundedBytes(b.clone().into())); Ok(value) }