fix: satisfy clippy's demands
This commit is contained in:
parent
8b62873ef5
commit
4a8fecb70a
|
@ -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<Name> = Program {
|
||||
|
|
|
@ -1256,11 +1256,11 @@ pub fn convert_constants_to_data(constants: Vec<Rc<UplcConstant>>) -> Vec<UplcCo
|
|||
let constant = match constant.as_ref() {
|
||||
UplcConstant::Integer(i) => 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),
|
||||
|
|
|
@ -1767,7 +1767,7 @@ fn get_compatible_record_fields<A>(
|
|||
return compatible;
|
||||
}
|
||||
|
||||
let first = match constructors.get(0) {
|
||||
let first = match constructors.first() {
|
||||
Some(first) => first,
|
||||
None => return compatible,
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -250,7 +250,7 @@ impl Annotated<Schema> {
|
|||
|
||||
"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<Schema> {
|
|||
|
||||
"List" => {
|
||||
let generic = Annotated::do_from_type(
|
||||
args.get(0)
|
||||
args.first()
|
||||
.expect("List types have always one generic argument"),
|
||||
modules,
|
||||
type_parameters,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue