Skip to content

Commit 1c2ccef

Browse files
committed
style: Enable additional lints
1 parent 3aa95dd commit 1c2ccef

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,19 @@ range_plus_one = "warn"
9999
redundant_else = "warn"
100100
ref_binding_to_reference = "warn"
101101
ref_option_ref = "warn"
102+
return_self_not_must_use = "warn"
102103
same_functions_in_if_condition = "warn"
103104
should_panic_without_expect = "warn"
104105
stable_sort_primitive = "warn"
106+
struct_field_names = "warn"
107+
trivially_copy_pass_by_ref = "warn"
105108
unchecked_duration_subtraction = "warn"
109+
uninlined_format_args = "warn"
106110
unnecessary_box_returns = "warn"
107111
unnecessary_join = "warn"
108112
unnecessary_wraps = "warn"
113+
unnested_or_patterns = "warn"
114+
unreadable_literal = "warn"
109115
unused_async = "warn"
110116
used_underscore_binding = "warn"
111117
verbose_bit_mask = "warn"

constraint-evaluation-generator/src/codegen/tasm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ impl Codegen for TasmBackend {
8989
quote!(
9090
#uses
9191
#[doc = #doc_comment]
92+
#[allow(clippy::unreadable_literal)]
9293
pub fn air_constraint_evaluation_tasm(
9394
mem_layout: TasmConstraintEvaluationMemoryLayout,
9495
) -> Vec<LabelledInstruction> {

triton-vm/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,6 @@ mod tests {
427427
let program = triton_program!(push 4294967297 push 1 and halt);
428428
let_assert!(Err(err) = program.run([].into(), [].into()));
429429
let_assert!(InstructionError::FailedU32Conversion(element) = err.source);
430-
assert!(4294967297 == element.value());
430+
assert!(4_294_967_297 == element.value());
431431
}
432432
}

triton-vm/src/parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn pretty_print_error(s: &str, mut e: VerboseError<&str>) -> String {
8989
let (_root_s, root_error) = e.errors[0].clone();
9090
if matches!(
9191
root_error,
92-
VerboseErrorKind::Nom(ErrorKind::Fail) | VerboseErrorKind::Nom(ErrorKind::Eof)
92+
VerboseErrorKind::Nom(ErrorKind::Fail | ErrorKind::Eof)
9393
) {
9494
e.errors.remove(0);
9595
}
@@ -510,7 +510,7 @@ fn label_addr(s_orig: &str) -> ParseResult<String> {
510510
}
511511
let (s, addr_part_1) = take_while(is_label_char)(s)?;
512512

513-
Ok((s, format!("{}{}", addr_part_0, addr_part_1)))
513+
Ok((s, format!("{addr_part_0}{addr_part_1}")))
514514
}
515515

516516
fn is_label_start_char(c: char) -> bool {
@@ -620,7 +620,7 @@ fn type_hint_variable_name(s: &str) -> ParseResult<String> {
620620
let (s, variable_name_start) = take_while1(is_type_hint_variable_name_start_character)(s)?;
621621
let (s, variable_name_end) = take_while(is_type_hint_variable_name_character)(s)?;
622622
let (s, _) = whitespace0(s)?;
623-
let variable_name = format!("{}{}", variable_name_start, variable_name_end);
623+
let variable_name = format!("{variable_name_start}{variable_name_end}");
624624
Ok((s, variable_name))
625625
}
626626

@@ -632,7 +632,7 @@ fn type_hint_type_name(s: &str) -> ParseResult<Option<String>> {
632632
let (s, type_name_start) = take_while1(is_type_hint_type_name_start_character)(s)?;
633633
let (s, type_name_end) = take_while(is_type_hint_type_name_character)(s)?;
634634
let (s, _) = whitespace0(s)?;
635-
let type_name = format!("{}{}", type_name_start, type_name_end);
635+
let type_name = format!("{type_name_start}{type_name_end}");
636636

637637
Ok((s, Some(type_name)))
638638
}

triton-vm/src/profiler.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,16 +416,19 @@ pub struct VMPerformanceProfile {
416416
}
417417

418418
impl VMPerformanceProfile {
419+
#[must_use]
419420
pub fn with_cycle_count(mut self, cycle_count: usize) -> Self {
420421
self.cycle_count = Some(cycle_count);
421422
self
422423
}
423424

425+
#[must_use]
424426
pub fn with_padded_height(mut self, padded_height: usize) -> Self {
425427
self.padded_height = Some(padded_height);
426428
self
427429
}
428430

431+
#[must_use]
429432
pub fn with_fri_domain_len(mut self, fri_domain_len: usize) -> Self {
430433
self.fri_domain_len = Some(fri_domain_len);
431434
self

triton-vm/src/program.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -963,14 +963,13 @@ mod tests {
963963
let program = triton_program!(halt);
964964
let digest = program.hash::<Tip5>();
965965

966-
let expected_digest = [
967-
4843866011885844809,
968-
16618866032559590857,
969-
18247689143239181392,
970-
7637465675240023996,
971-
9104890367162237026,
972-
]
973-
.map(BFieldElement::new);
966+
let expected_digest = bfe_array![
967+
0x4338_de79_520b_3949_u64,
968+
0xe6a2_129b_2885_0dc9_u64,
969+
0xfd3c_d098_6a86_0450_u64,
970+
0x69fd_ba91_0ceb_a7bc_u64,
971+
0x7e5b_118c_9594_c062_u64,
972+
];
974973
let expected_digest = Digest::new(expected_digest);
975974

976975
assert!(expected_digest == digest);

triton-vm/src/table/ram_table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ pub(crate) mod tests {
661661
let rp = [1, 2, 3].map(BFieldElement::new);
662662
let (a, b) = RamTable::bezout_coefficient_polynomials_coefficients(&rp);
663663

664-
let expected_a = [0x9, 0x7fffffff7ffffffc, 0x0].map(BFieldElement::new);
665-
let expected_b = [0x5, 0xfffffffefffffffb, 0x7fffffff80000002].map(BFieldElement::new);
664+
let expected_a = [9, 0x7fff_ffff_7fff_fffc, 0].map(BFieldElement::new);
665+
let expected_b = [5, 0xffff_fffe_ffff_fffb, 0x7fff_ffff_8000_0002].map(BFieldElement::new);
666666

667667
assert_eq!(expected_a, *a);
668668
assert_eq!(expected_b, *b);

0 commit comments

Comments
 (0)