chore: clippy autofix
This commit is contained in:
parent
4530507109
commit
a365649360
|
@ -1188,7 +1188,7 @@ pub fn expr_parser(
|
|||
.map(|(index, a)| match a {
|
||||
ParserArg::Arg(arg) => *arg,
|
||||
ParserArg::Hole { location, label } => {
|
||||
let name = format!("{}__{}", CAPTURE_VARIABLE, index);
|
||||
let name = format!("{CAPTURE_VARIABLE}__{index}");
|
||||
holes.push(ast::Arg {
|
||||
location: Span::empty(),
|
||||
annotation: None,
|
||||
|
@ -1205,7 +1205,7 @@ pub fn expr_parser(
|
|||
location,
|
||||
value: expr::UntypedExpr::Var {
|
||||
location,
|
||||
name: format!("{}__{}", CAPTURE_VARIABLE, index),
|
||||
name: format!("{CAPTURE_VARIABLE}__{index}"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ impl fmt::Display for Token {
|
|||
let index_str;
|
||||
let s = match self {
|
||||
Token::Error(c) => {
|
||||
write!(f, "\"{}\"", c)?;
|
||||
write!(f, "\"{c}\"")?;
|
||||
return Ok(());
|
||||
}
|
||||
Token::Name { name } => name,
|
||||
|
@ -159,6 +159,6 @@ impl fmt::Display for Token {
|
|||
Token::Test => "test",
|
||||
Token::ErrorTerm => "error",
|
||||
};
|
||||
write!(f, "\"{}\"", s)
|
||||
write!(f, "\"{s}\"")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ pub trait Documentable<'a> {
|
|||
|
||||
impl<'a> Documentable<'a> for char {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{}", self))
|
||||
Document::String(format!("{self}"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,49 +49,49 @@ impl<'a> Documentable<'a> for &'a str {
|
|||
|
||||
impl<'a> Documentable<'a> for isize {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{}", self))
|
||||
Document::String(format!("{self}"))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Documentable<'a> for i64 {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{}", self))
|
||||
Document::String(format!("{self}"))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Documentable<'a> for usize {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{}", self))
|
||||
Document::String(format!("{self}"))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Documentable<'a> for f64 {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{:?}", self))
|
||||
Document::String(format!("{self:?}"))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Documentable<'a> for u64 {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{:?}", self))
|
||||
Document::String(format!("{self:?}"))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Documentable<'a> for u32 {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{}", self))
|
||||
Document::String(format!("{self}"))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Documentable<'a> for u16 {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{}", self))
|
||||
Document::String(format!("{self}"))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Documentable<'a> for u8 {
|
||||
fn to_doc(self) -> Document<'a> {
|
||||
Document::String(format!("{}", self))
|
||||
Document::String(format!("{self}"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -756,7 +756,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
if next_list_size == current_clause_index {
|
||||
None
|
||||
} else {
|
||||
Some(format!("__tail_{}", current_clause_index))
|
||||
Some(format!("__tail_{current_clause_index}"))
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1344,7 +1344,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
current_index: index as i64,
|
||||
};
|
||||
|
||||
let tail_name = format!("{}_{}", new_tail_name, index);
|
||||
let tail_name = format!("{new_tail_name}_{index}");
|
||||
|
||||
if elements.len() - 1 == index {
|
||||
if tail.is_some() {
|
||||
|
@ -1969,11 +1969,11 @@ impl<'a> CodeGenerator<'a> {
|
|||
current_index += 1;
|
||||
} else {
|
||||
let id_next = self.id_gen.next();
|
||||
final_args.push((format!("__field_{index}_{}", id_next), index));
|
||||
final_args.push((format!("__field_{index}_{id_next}"), index));
|
||||
self.recursive_assert_tipo(
|
||||
type_map.get(&index).unwrap(),
|
||||
&mut nested_pattern,
|
||||
&format!("__field_{index}_{}", id_next),
|
||||
&format!("__field_{index}_{id_next}"),
|
||||
scope.clone(),
|
||||
)
|
||||
}
|
||||
|
@ -2068,11 +2068,11 @@ impl<'a> CodeGenerator<'a> {
|
|||
current_index += 1;
|
||||
} else {
|
||||
let id_next = self.id_gen.next();
|
||||
final_args.push((format!("__tuple_{index}_{}", id_next), index));
|
||||
final_args.push((format!("__tuple_{index}_{id_next}"), index));
|
||||
self.recursive_assert_tipo(
|
||||
type_map.get(&index).unwrap(),
|
||||
&mut nested_pattern,
|
||||
&format!("__tuple_{index}_{}", id_next),
|
||||
&format!("__tuple_{index}_{id_next}"),
|
||||
scope.clone(),
|
||||
)
|
||||
}
|
||||
|
@ -2159,7 +2159,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
|
||||
assert_vec.push(Air::Fn {
|
||||
scope: scope.clone(),
|
||||
params: vec![format!("__pair_{}", new_id)],
|
||||
params: vec![format!("__pair_{new_id}")],
|
||||
});
|
||||
|
||||
assert_vec.push(Air::TupleAccessor {
|
||||
|
@ -2180,7 +2180,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
location: Span::empty(),
|
||||
},
|
||||
),
|
||||
name: format!("__pair_{}", new_id),
|
||||
name: format!("__pair_{new_id}"),
|
||||
variant_name: String::new(),
|
||||
});
|
||||
|
||||
|
@ -2248,12 +2248,12 @@ impl<'a> CodeGenerator<'a> {
|
|||
|
||||
assert_vec.push(Air::Fn {
|
||||
scope: scope.clone(),
|
||||
params: vec![format!("__list_item_{}", new_id)],
|
||||
params: vec![format!("__list_item_{new_id}")],
|
||||
});
|
||||
|
||||
assert_vec.push(Air::Let {
|
||||
scope: scope.clone(),
|
||||
name: format!("__list_item_{}", new_id),
|
||||
name: format!("__list_item_{new_id}"),
|
||||
});
|
||||
|
||||
assert_vec.push(Air::UnWrapData {
|
||||
|
@ -2269,14 +2269,14 @@ impl<'a> CodeGenerator<'a> {
|
|||
location: Span::empty(),
|
||||
},
|
||||
),
|
||||
name: format!("__list_item_{}", new_id),
|
||||
name: format!("__list_item_{new_id}"),
|
||||
variant_name: String::new(),
|
||||
});
|
||||
|
||||
self.recursive_assert_tipo(
|
||||
inner_list_type,
|
||||
assert_vec,
|
||||
&format!("__list_item_{}", new_id),
|
||||
&format!("__list_item_{new_id}"),
|
||||
scope.clone(),
|
||||
);
|
||||
|
||||
|
@ -2292,7 +2292,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
scope: scope.clone(),
|
||||
names: new_id_list
|
||||
.iter()
|
||||
.map(|(index, id)| format!("__tuple_index_{}_{}", index, id))
|
||||
.map(|(index, id)| format!("__tuple_index_{index}_{id}"))
|
||||
.collect_vec(),
|
||||
tipo: tipo.clone().into(),
|
||||
check_last_item: true,
|
||||
|
@ -2312,7 +2312,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
|
||||
for (index, name) in new_id_list
|
||||
.into_iter()
|
||||
.map(|(index, id)| (index, format!("__tuple_index_{}_{}", index, id)))
|
||||
.map(|(index, id)| (index, format!("__tuple_index_{index}_{id}")))
|
||||
{
|
||||
self.recursive_assert_tipo(
|
||||
&tuple_inner_types[index],
|
||||
|
@ -2340,7 +2340,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
assert_vec.push(Air::When {
|
||||
scope: scope.clone(),
|
||||
tipo: tipo.clone().into(),
|
||||
subject_name: format!("__subject_{}", new_id),
|
||||
subject_name: format!("__subject_{new_id}"),
|
||||
});
|
||||
|
||||
assert_vec.push(Air::Var {
|
||||
|
@ -2364,7 +2364,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
let arg_name = arg
|
||||
.label
|
||||
.clone()
|
||||
.unwrap_or(format!("__field_{}_{}", index, new_id));
|
||||
.unwrap_or(format!("__field_{index}_{new_id}"));
|
||||
(index, arg_name, arg.tipo.clone())
|
||||
})
|
||||
.collect_vec();
|
||||
|
@ -2372,7 +2372,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
assert_vec.push(Air::Clause {
|
||||
scope: scope.clone(),
|
||||
tipo: tipo.clone().into(),
|
||||
subject_name: format!("__subject_{}", new_id),
|
||||
subject_name: format!("__subject_{new_id}"),
|
||||
complex_clause: false,
|
||||
});
|
||||
|
||||
|
@ -3716,7 +3716,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
Term::Builtin(DefaultFunction::HeadList).force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__list_{}", list_id),
|
||||
text: format!("__list_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -3728,7 +3728,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
Term::Builtin(DefaultFunction::HeadList).force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__list_{}", list_id),
|
||||
text: format!("__list_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -3748,7 +3748,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
term = apply_wrap(
|
||||
Term::Lambda {
|
||||
parameter_name: Name {
|
||||
text: format!("__list_{}", list_id),
|
||||
text: format!("__list_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -3773,7 +3773,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
Term::Builtin(DefaultFunction::TailList).force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__list_{}", list_id),
|
||||
text: format!("__list_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -3953,7 +3953,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
term,
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__arg_{}", id),
|
||||
text: format!("__arg_{id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -3969,7 +3969,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
term = convert_data_to_type(term, &inner_type);
|
||||
term = Term::Lambda {
|
||||
parameter_name: Name {
|
||||
text: format!("__arg_{}", id),
|
||||
text: format!("__arg_{id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -4039,7 +4039,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
arg_stack.push(term);
|
||||
return;
|
||||
} else if tipo.is_tuple()
|
||||
&& matches!(tipo.clone().get_uplc_type(), UplcType::Pair(_, _))
|
||||
&& matches!(tipo.get_uplc_type(), UplcType::Pair(_, _))
|
||||
{
|
||||
let term = apply_wrap(
|
||||
apply_wrap(
|
||||
|
@ -4134,7 +4134,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
arg_stack.push(term);
|
||||
return;
|
||||
} else if tipo.is_tuple()
|
||||
&& matches!(tipo.clone().get_uplc_type(), UplcType::Pair(_, _))
|
||||
&& matches!(tipo.get_uplc_type(), UplcType::Pair(_, _))
|
||||
{
|
||||
let mut term = apply_wrap(
|
||||
apply_wrap(
|
||||
|
@ -5030,7 +5030,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
Term::Builtin(DefaultFunction::HeadList).force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__constr_fields_{}", list_id),
|
||||
text: format!("__constr_fields_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -5057,7 +5057,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
Term::Builtin(DefaultFunction::TailList).force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__constr_fields_{}", list_id),
|
||||
text: format!("__constr_fields_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -5071,7 +5071,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
term = apply_wrap(
|
||||
Term::Lambda {
|
||||
parameter_name: Name {
|
||||
text: format!("__constr_fields_{}", list_id),
|
||||
text: format!("__constr_fields_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -5260,7 +5260,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
if !unchanged_field_indices.is_empty() {
|
||||
prev_index = highest_index;
|
||||
for index in unchanged_field_indices.into_iter() {
|
||||
let tail_name = format!("{tail_name_prefix}_{}", prev_index);
|
||||
let tail_name = format!("{tail_name_prefix}_{prev_index}");
|
||||
let prev_tail_name = format!("{tail_name_prefix}_{index}");
|
||||
|
||||
let mut tail_list = Term::Var(
|
||||
|
@ -5429,7 +5429,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
term = apply_wrap(
|
||||
Term::Lambda {
|
||||
parameter_name: Name {
|
||||
text: format!("__tuple_{}", list_id),
|
||||
text: format!("__tuple_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -5456,7 +5456,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
.force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__tuple_{}", list_id),
|
||||
text: format!("__tuple_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -5474,7 +5474,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
.force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__tuple_{}", list_id),
|
||||
text: format!("__tuple_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -5502,7 +5502,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
Term::Builtin(DefaultFunction::HeadList).force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__tuple_{}", list_id),
|
||||
text: format!("__tuple_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -5514,7 +5514,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
term = apply_wrap(
|
||||
Term::Lambda {
|
||||
parameter_name: Name {
|
||||
text: format!("__tuple_{}", list_id),
|
||||
text: format!("__tuple_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
@ -5539,7 +5539,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
Term::Builtin(DefaultFunction::TailList).force_wrap(),
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("__tuple_{}", list_id),
|
||||
text: format!("__tuple_{list_id}"),
|
||||
unique: 0.into(),
|
||||
}
|
||||
.into(),
|
||||
|
|
|
@ -133,7 +133,7 @@ impl Server {
|
|||
id,
|
||||
error: Some(lsp_server::ResponseError {
|
||||
code: 1, // We should assign a code to each error.
|
||||
message: format!("{:?}", error),
|
||||
message: format!("{error:?}"),
|
||||
data: None,
|
||||
}),
|
||||
result: None,
|
||||
|
|
|
@ -124,7 +124,7 @@ impl TryFrom<String> for Purpose {
|
|||
"mint" => Ok(Purpose::Mint),
|
||||
"withdraw" => Ok(Purpose::Withdraw),
|
||||
"publish" => Ok(Purpose::Publish),
|
||||
unexpected => Err(format!("Can't turn '{}' into any Purpose", unexpected)),
|
||||
unexpected => Err(format!("Can't turn '{unexpected}' into any Purpose")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ mod test {
|
|||
let validator = Validator::from_checked_module(&modules, &mut generator, validator, def)
|
||||
.expect("Failed to create validator blueprint");
|
||||
|
||||
println!("{}", validator);
|
||||
println!("{validator}");
|
||||
assert_json_eq!(serde_json::to_value(&validator).unwrap(), json);
|
||||
}
|
||||
|
||||
|
|
|
@ -156,10 +156,10 @@ impl Error {
|
|||
match self {
|
||||
Error::List(errors) => {
|
||||
for error in errors {
|
||||
eprintln!("Error: {:?}", error)
|
||||
eprintln!("Error: {error:?}")
|
||||
}
|
||||
}
|
||||
rest => eprintln!("Error: {:?}", rest),
|
||||
rest => eprintln!("Error: {rest:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,7 @@ impl Warning {
|
|||
}
|
||||
|
||||
pub fn report(&self) {
|
||||
eprintln!("Warning: {:?}", self)
|
||||
eprintln!("Warning: {self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ fn process_stdin(check: bool) -> Result<(), Error> {
|
|||
aiken_lang::format::pretty(&mut out, module, extra, &src);
|
||||
|
||||
if !check {
|
||||
print!("{}", out);
|
||||
print!("{out}");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ pub fn exec(
|
|||
println!("cpu: {}", total_budget_used.cpu);
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("\nError\n-----\n\n{}\n", err);
|
||||
eprintln!("\nError\n-----\n\n{err}\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ pub fn exec(
|
|||
println!("\nResult\n------\n\n{}\n", term.to_pretty());
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("\nError\n-----\n\n{}\n", err);
|
||||
eprintln!("\nError\n-----\n\n{err}\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ pub fn exec(
|
|||
let mut output = String::new();
|
||||
|
||||
for (i, byte) in bytes.iter().enumerate() {
|
||||
let _ = write!(output, "{:08b}", byte);
|
||||
let _ = write!(output, "{byte:08b}");
|
||||
|
||||
if (i + 1) % 4 == 0 {
|
||||
output.push('\n');
|
||||
|
@ -53,7 +53,7 @@ pub fn exec(
|
|||
}
|
||||
}
|
||||
|
||||
println!("{}", output);
|
||||
println!("{output}");
|
||||
} else {
|
||||
let out_name = if let Some(out) = out {
|
||||
out
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn exec(Args { input, print }: Args) -> miette::Result<()> {
|
|||
let pretty = program.to_pretty();
|
||||
|
||||
if print {
|
||||
println!("{}", pretty);
|
||||
println!("{pretty}");
|
||||
} else {
|
||||
fs::write(&input, pretty).into_diagnostic()?;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ pub fn exec(
|
|||
let pretty = program.to_pretty();
|
||||
|
||||
if print {
|
||||
println!("{}", pretty);
|
||||
println!("{pretty}");
|
||||
} else {
|
||||
let out_name = if let Some(out) = out {
|
||||
out
|
||||
|
|
|
@ -38,7 +38,7 @@ where
|
|||
err.report();
|
||||
println!("\n{}", "Summary".purple().bold());
|
||||
|
||||
let warning_text = format!("{warning_count} warning{}", plural);
|
||||
let warning_text = format!("{warning_count} warning{plural}");
|
||||
|
||||
let plural = if err.len() == 1 { "" } else { "s" };
|
||||
|
||||
|
@ -46,13 +46,13 @@ where
|
|||
|
||||
let full_summary = format!(" {}, {}", error_text.red(), warning_text.yellow());
|
||||
|
||||
println!("{}", full_summary);
|
||||
println!("{full_summary}");
|
||||
|
||||
process::exit(1);
|
||||
} else {
|
||||
println!("\n{}", "Summary".purple().bold());
|
||||
|
||||
let warning_text = format!("{warning_count} warning{}", plural);
|
||||
let warning_text = format!("{warning_count} warning{plural}");
|
||||
|
||||
println!(" 0 errors, {}", warning_text.yellow(),);
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ impl telemetry::EventListener for Terminal {
|
|||
let elapsed = format!("{:.2}s", start.elapsed().as_millis() as f32 / 1000.);
|
||||
|
||||
let msg = match count {
|
||||
1 => format!("1 package in {}", elapsed),
|
||||
_ => format!("{} packages in {}", count, elapsed),
|
||||
1 => format!("1 package in {elapsed}"),
|
||||
_ => format!("{count} packages in {elapsed}"),
|
||||
};
|
||||
|
||||
println!("{} {}", " Downloaded".bold().purple(), msg.bold())
|
||||
|
@ -244,11 +244,11 @@ fn fmt_test_summary(tests: &Vec<&EvalInfo>, styled: bool) -> String {
|
|||
pretty::style_if(styled, format!("{} tests", tests.len()), |s| s
|
||||
.bold()
|
||||
.to_string()),
|
||||
pretty::style_if(styled, format!("{} passed", n_passed), |s| s
|
||||
pretty::style_if(styled, format!("{n_passed} passed"), |s| s
|
||||
.bright_green()
|
||||
.bold()
|
||||
.to_string()),
|
||||
pretty::style_if(styled, format!("{} failed", n_failed), |s| s
|
||||
pretty::style_if(styled, format!("{n_failed} failed"), |s| s
|
||||
.bright_red()
|
||||
.bold()
|
||||
.to_string()),
|
||||
|
@ -273,7 +273,7 @@ fn fmt_eval(eval_info: &EvalInfo, max_mem: usize, max_cpu: usize) -> String {
|
|||
pretty::pad_left(cpu.to_string(), max_cpu, " "),
|
||||
output
|
||||
.as_ref()
|
||||
.map(|x| format!("{}", x))
|
||||
.map(|x| format!("{x}"))
|
||||
.unwrap_or_else(|| "Error.".to_string()),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ impl<T: WithTerm> WithIdentity for T {}
|
|||
fn main() {
|
||||
let my_var = "some_var";
|
||||
let program = Builder::start(1, 2, 3).with_identity(my_var).build_named();
|
||||
println!("{:#?}", program);
|
||||
println!("{program:#?}");
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ impl<'a> Deserialize<'a> for Program<DeBruijn> {
|
|||
Program::<DeBruijn>::from_hex(&compiled_code, &mut cbor_buffer, &mut flat_buffer)
|
||||
.map_err(|e| {
|
||||
de::Error::invalid_value(
|
||||
de::Unexpected::Other(&format!("{}", e)),
|
||||
de::Unexpected::Other(&format!("{e}")),
|
||||
&"a base16-encoded CBOR-serialized UPLC program",
|
||||
)
|
||||
})
|
||||
|
@ -266,8 +266,8 @@ impl Display for Type {
|
|||
Type::String => write!(f, "string"),
|
||||
Type::ByteString => write!(f, "bytestring"),
|
||||
Type::Unit => write!(f, "unit"),
|
||||
Type::List(t) => write!(f, "list {}", t),
|
||||
Type::Pair(t1, t2) => write!(f, "pair {} {}", t1, t2),
|
||||
Type::List(t) => write!(f, "list {t}"),
|
||||
Type::Pair(t1, t2) => write!(f, "pair {t1} {t2}"),
|
||||
Type::Data => write!(f, "data"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,8 +192,7 @@ impl TryFrom<u8> for DefaultFunction {
|
|||
v if v == DefaultFunction::MkNilData as u8 => Ok(DefaultFunction::MkNilData),
|
||||
v if v == DefaultFunction::MkNilPairData as u8 => Ok(DefaultFunction::MkNilPairData),
|
||||
_ => Err(de::Error::Message(format!(
|
||||
"Default Function not found - {}",
|
||||
v
|
||||
"Default Function not found - {v}"
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +259,7 @@ impl FromStr for DefaultFunction {
|
|||
"mkPairData" => Ok(MkPairData),
|
||||
"mkNilData" => Ok(MkNilData),
|
||||
"mkNilPairData" => Ok(MkNilPairData),
|
||||
rest => Err(format!("Default Function not found - {}", rest)),
|
||||
rest => Err(format!("Default Function not found - {rest}")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ impl Converter {
|
|||
|
||||
Term::Var(
|
||||
Name {
|
||||
text: format!("i_{}", unique),
|
||||
text: format!("i_{unique}"),
|
||||
unique,
|
||||
}
|
||||
.into(),
|
||||
|
@ -195,7 +195,7 @@ impl Converter {
|
|||
let unique = self.get_unique(parameter_name)?;
|
||||
|
||||
let name = Name {
|
||||
text: format!("i_{}", unique),
|
||||
text: format!("i_{unique}"),
|
||||
unique,
|
||||
};
|
||||
|
||||
|
@ -251,7 +251,7 @@ impl Converter {
|
|||
match term {
|
||||
Term::Var(name) => Term::Var(
|
||||
NamedDeBruijn {
|
||||
text: format!("i_{}", name),
|
||||
text: format!("i_{name}"),
|
||||
index: *name.as_ref(),
|
||||
}
|
||||
.into(),
|
||||
|
|
|
@ -207,7 +207,7 @@ where
|
|||
Err(de::Error::UnknownTermConstructor(
|
||||
x,
|
||||
if d.pos > 5 { 5 } else { d.pos },
|
||||
format!("{:02X?}", buffer_slice),
|
||||
format!("{buffer_slice:02X?}"),
|
||||
d.pos,
|
||||
d.buffer.len(),
|
||||
))
|
||||
|
@ -347,7 +347,7 @@ where
|
|||
let builtin_option = DefaultFunction::decode(d);
|
||||
match builtin_option {
|
||||
Ok(builtin) => {
|
||||
state_log.push(format!("{})", builtin));
|
||||
state_log.push(format!("{builtin})"));
|
||||
Ok(Term::Builtin(builtin))
|
||||
}
|
||||
Err(error) => {
|
||||
|
@ -371,7 +371,7 @@ where
|
|||
Err(de::Error::UnknownTermConstructor(
|
||||
x,
|
||||
if d.pos > 5 { 5 } else { d.pos },
|
||||
format!("{:02X?}", buffer_slice),
|
||||
format!("{buffer_slice:02X?}"),
|
||||
d.pos,
|
||||
d.buffer.len(),
|
||||
))
|
||||
|
@ -526,8 +526,7 @@ impl<'b> Decode<'b> for Constant {
|
|||
Ok(Constant::Data(data))
|
||||
}
|
||||
x => Err(de::Error::Message(format!(
|
||||
"Unknown constant constructor tag: {:?}",
|
||||
x
|
||||
"Unknown constant constructor tag: {x:?}"
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
@ -586,21 +585,18 @@ fn decode_type(types: &mut VecDeque<u8>) -> Result<Type, de::Error> {
|
|||
Ok(Type::Pair(type1.into(), type2.into()))
|
||||
}
|
||||
Some(x) => Err(de::Error::Message(format!(
|
||||
"Unknown constant type tag: {}",
|
||||
x
|
||||
"Unknown constant type tag: {x}"
|
||||
))),
|
||||
None => Err(de::Error::Message("Unexpected empty buffer".to_string())),
|
||||
},
|
||||
Some(x) => Err(de::Error::Message(format!(
|
||||
"Unknown constant type tag: {}",
|
||||
x
|
||||
"Unknown constant type tag: {x}"
|
||||
))),
|
||||
None => Err(de::Error::Message("Unexpected empty buffer".to_string())),
|
||||
},
|
||||
|
||||
Some(x) => Err(de::Error::Message(format!(
|
||||
"Unknown constant type tag: {}",
|
||||
x
|
||||
"Unknown constant type tag: {x}"
|
||||
))),
|
||||
None => Err(de::Error::Message("Unexpected empty buffer".to_string())),
|
||||
}
|
||||
|
@ -779,8 +775,7 @@ fn decode_term_tag(d: &mut Decoder) -> Result<u8, de::Error> {
|
|||
fn safe_encode_bits(num_bits: u32, byte: u8, e: &mut Encoder) -> Result<(), en::Error> {
|
||||
if 2_u8.pow(num_bits) < byte {
|
||||
Err(en::Error::Message(format!(
|
||||
"Overflow detected, cannot fit {} in {} bits.",
|
||||
byte, num_bits
|
||||
"Overflow detected, cannot fit {byte} in {num_bits} bits."
|
||||
)))
|
||||
} else {
|
||||
e.bits(num_bits as i64, byte);
|
||||
|
|
|
@ -676,7 +676,7 @@ impl DefaultFunction {
|
|||
(Value::Con(string1), Value::Con(string2)) => {
|
||||
match (string1.as_ref(), string2.as_ref()) {
|
||||
(Constant::String(arg1), Constant::String(arg2)) => Ok(Value::Con(
|
||||
Constant::String(format!("{}{}", arg1, arg2)).into(),
|
||||
Constant::String(format!("{arg1}{arg2}")).into(),
|
||||
)),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ mod tests {
|
|||
) {
|
||||
let code = format!(r"(program
|
||||
11.22.33
|
||||
(con integer {})
|
||||
)", int);
|
||||
(con integer {int})
|
||||
)");
|
||||
let expected = parser::program(&code).unwrap();
|
||||
let actual = Builder::start(11, 22, 33).with_int(int).build_named();
|
||||
assert_eq!(expected, actual);
|
||||
|
@ -62,8 +62,8 @@ mod tests {
|
|||
let bstring = hex::encode(&bytes);
|
||||
let code = format!(r"(program
|
||||
11.22.33
|
||||
(con bytestring #{})
|
||||
)", bstring);
|
||||
(con bytestring #{bstring})
|
||||
)");
|
||||
let expected = parser::program(&code).unwrap();
|
||||
let actual = Builder::start(11, 22, 33)
|
||||
.with_byte_string(bytes)
|
||||
|
|
|
@ -23,9 +23,9 @@ proptest! {
|
|||
(maj, min, patch) in arb_version(),
|
||||
) {
|
||||
let code = format!(r"(program
|
||||
{}.{}.{}
|
||||
{maj}.{min}.{patch}
|
||||
(con integer 11)
|
||||
)", maj, min, patch);
|
||||
)");
|
||||
let expected = parser::program(&code).unwrap();
|
||||
let actual = Builder::start(maj, min, patch).with_int(11).build_named();
|
||||
assert_eq!(expected, actual);
|
||||
|
|
|
@ -48,13 +48,13 @@ pub fn validate_missing_scripts(
|
|||
.clone()
|
||||
.into_iter()
|
||||
.filter(|x| !received_hashes.contains(x))
|
||||
.map(|x| format!("[Missing (sh: {})]", x))
|
||||
.map(|x| format!("[Missing (sh: {x})]"))
|
||||
.collect();
|
||||
|
||||
let extra: Vec<_> = received_hashes
|
||||
.into_iter()
|
||||
.filter(|x| !needed_hashes.contains(x))
|
||||
.map(|x| format!("[Extraneous (sh: {:?})]", x))
|
||||
.map(|x| format!("[Extraneous (sh: {x:?})]"))
|
||||
.collect();
|
||||
|
||||
if !missing.is_empty() || !extra.is_empty() {
|
||||
|
@ -206,7 +206,7 @@ pub fn has_exact_set_of_redeemers(
|
|||
let extra: Vec<_> = wits_redeemer_ptrs
|
||||
.into_iter()
|
||||
.filter(|x| !needed_redeemer_ptrs.contains(x))
|
||||
.map(|x| format!("[Extraneous (redeemer_ptr: {:?})]", x))
|
||||
.map(|x| format!("[Extraneous (redeemer_ptr: {x:?})]"))
|
||||
.collect();
|
||||
|
||||
if !missing.is_empty() || !extra.is_empty() {
|
||||
|
|
|
@ -259,7 +259,7 @@ fn test_eval() {
|
|||
cpu: accum.cpu + curr.ex_units.steps as i64,
|
||||
});
|
||||
|
||||
println!("{:?}", total_budget_used);
|
||||
println!("{total_budget_used:?}");
|
||||
|
||||
assert_eq!(
|
||||
total_budget_used,
|
||||
|
@ -529,7 +529,7 @@ fn test_eval_1() {
|
|||
cpu: accum.cpu + curr.ex_units.steps as i64,
|
||||
});
|
||||
|
||||
println!("{:?}", total_budget_used);
|
||||
println!("{total_budget_used:?}");
|
||||
|
||||
assert_eq!(
|
||||
total_budget_used,
|
||||
|
@ -634,7 +634,7 @@ fn test_eval_2() {
|
|||
cpu: accum.cpu + curr.ex_units.steps as i64,
|
||||
});
|
||||
|
||||
println!("{:?}", total_budget_used);
|
||||
println!("{total_budget_used:?}");
|
||||
|
||||
assert_eq!(
|
||||
total_budget_used,
|
||||
|
@ -898,7 +898,7 @@ fn test_eval_3() {
|
|||
cpu: accum.cpu + curr.ex_units.steps as i64,
|
||||
});
|
||||
|
||||
println!("{:?}", total_budget_used);
|
||||
println!("{total_budget_used:?}");
|
||||
|
||||
assert_eq!(
|
||||
total_budget_used,
|
||||
|
@ -1082,7 +1082,7 @@ fn test_eval_5() {
|
|||
cpu: accum.cpu + curr.ex_units.steps as i64,
|
||||
});
|
||||
|
||||
println!("{:?}", total_budget_used);
|
||||
println!("{total_budget_used:?}");
|
||||
|
||||
assert_eq!(
|
||||
total_budget_used,
|
||||
|
@ -1186,7 +1186,7 @@ fn test_eval_6() {
|
|||
cpu: accum.cpu + curr.ex_units.steps as i64,
|
||||
});
|
||||
|
||||
println!("{:?}", total_budget_used);
|
||||
println!("{total_budget_used:?}");
|
||||
|
||||
assert_eq!(
|
||||
total_budget_used,
|
||||
|
@ -1290,7 +1290,7 @@ fn test_eval_7() {
|
|||
cpu: accum.cpu + curr.ex_units.steps as i64,
|
||||
});
|
||||
|
||||
println!("{:?}", total_budget_used);
|
||||
println!("{total_budget_used:?}");
|
||||
|
||||
assert_eq!(
|
||||
total_budget_used,
|
||||
|
@ -1545,7 +1545,7 @@ fn test_eval_8() {
|
|||
cpu: accum.cpu + curr.ex_units.steps as i64,
|
||||
});
|
||||
|
||||
println!("{:?}", total_budget_used);
|
||||
println!("{total_budget_used:?}");
|
||||
|
||||
assert_eq!(
|
||||
total_budget_used,
|
||||
|
|
Loading…
Reference in New Issue