Skip to content

Commit

Permalink
chore: Adhere to new clippy lints
Browse files Browse the repository at this point in the history
changelog: ignore
  • Loading branch information
jan-ferdinand committed Dec 8, 2024
1 parent 5a16da9 commit 814f5d5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
18 changes: 9 additions & 9 deletions triton-isa/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub enum InstructionToken<'a> {
AssertionContext(AssertionContext, &'a str),
}

impl<'a> Display for ParseError<'a> {
impl Display for ParseError<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
let mut errors = self.errors.clone();
if matches!(
Expand All @@ -71,7 +71,7 @@ impl<'a> Display for ParseError<'a> {
}
}

impl<'a> Error for ParseError<'a> {}
impl Error for ParseError<'_> {}

impl<'a> InstructionToken<'a> {
pub fn token_str(&self) -> &'a str {
Expand Down Expand Up @@ -383,7 +383,7 @@ fn is_illegal_label(s: &str) -> bool {
fn instruction<'a>(
name: &'a str,
instruction: AnInstruction<String>,
) -> impl Fn(&'a str) -> ParseResult<AnInstruction<String>> {
) -> impl Fn(&'a str) -> ParseResult<'a, AnInstruction<String>> {
move |s: &'a str| {
let (s, _) = token1(name)(s)?;
Ok((s, instruction.clone()))
Expand Down Expand Up @@ -454,7 +454,7 @@ fn swap_instruction() -> impl Fn(&str) -> ParseResult<AnInstruction<String>> {
}
}

fn call_instruction<'a>() -> impl Fn(&'a str) -> ParseResult<AnInstruction<String>> {
fn call_instruction<'a>() -> impl Fn(&'a str) -> ParseResult<'a, AnInstruction<String>> {
move |s: &'a str| {
let (s, _) = token1("call")(s)?;
let (s, label) = label_addr(s)?;
Expand Down Expand Up @@ -604,7 +604,7 @@ fn comment_or_whitespace0(s: &str) -> ParseResult<&str> {
/// Parse at least one comment and/or whitespace, or eof.
///
/// This is used after places where whitespace is mandatory (e.g. after tokens).
fn comment_or_whitespace1<'a>(s: &'a str) -> ParseResult<&'a str> {
fn comment_or_whitespace1<'a>(s: &'a str) -> ParseResult<'a, &'a str> {
let cws1 = |s: &'a str| -> ParseResult<&str> {
let (s, _) = many1(alt((comment1, whitespace1)))(s)?;
Ok((s, ""))
Expand Down Expand Up @@ -636,7 +636,7 @@ fn is_linebreak(c: char) -> bool {
}

/// `token0(tok)` will parse the string `tok` and munch 0 or more comment or whitespace.
fn token0<'a>(token: &'a str) -> impl Fn(&'a str) -> ParseResult<()> {
fn token0<'a>(token: &'a str) -> impl Fn(&'a str) -> ParseResult<'a, ()> {
move |s: &'a str| {
let (s, _) = tag(token)(s)?;
let (s, _) = comment_or_whitespace0(s)?;
Expand All @@ -646,7 +646,7 @@ fn token0<'a>(token: &'a str) -> impl Fn(&'a str) -> ParseResult<()> {

/// `token1(tok)` will parse the string `tok` and munch at least one comment and/or whitespace,
/// or eof.
fn token1<'a>(token: &'a str) -> impl Fn(&'a str) -> ParseResult<()> {
fn token1<'a>(token: &'a str) -> impl Fn(&'a str) -> ParseResult<'a, ()> {
move |s: &'a str| {
let (s, _) = tag(token)(s)?;
let (s, _) = comment_or_whitespace1(s)?;
Expand Down Expand Up @@ -856,7 +856,7 @@ pub(crate) mod tests {
message: &'static str,
}

impl<'a> TestCase<'a> {
impl TestCase<'_> {
fn run(&self) {
let message = self.message;
let parse_result = parse(self.input).map_err(|err| format!("{message}:\n{err}"));
Expand All @@ -870,7 +870,7 @@ pub(crate) mod tests {
}
}

impl<'a> NegativeTestCase<'a> {
impl NegativeTestCase<'_> {
fn run(self) {
let Self {
input,
Expand Down
14 changes: 10 additions & 4 deletions triton-vm/src/fri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct ProverRound {
merkle_tree: MerkleTree,
}

impl<'stream> FriProver<'stream> {
impl FriProver<'_> {
fn commit(&mut self, codeword: &[XFieldElement]) -> ProverResult<()> {
self.commit_to_first_round(codeword)?;
for _ in 0..self.num_rounds {
Expand Down Expand Up @@ -212,7 +212,7 @@ struct VerifierRound {
folding_challenge: Option<XFieldElement>,
}

impl<'stream> FriVerifier<'stream> {
impl FriVerifier<'_> {
fn initialize(&mut self) -> VerifierResult<()> {
let domain = self.first_round_domain;
let first_round = self.construct_round_with_domain(domain)?;
Expand Down Expand Up @@ -541,7 +541,10 @@ impl Fri {
Ok(prover.first_round_collinearity_check_indices)
}

fn prover<'stream>(&'stream self, proof_stream: &'stream mut ProofStream) -> FriProver {
fn prover<'stream>(
&'stream self,
proof_stream: &'stream mut ProofStream,
) -> FriProver<'stream> {
FriProver {
proof_stream,
rounds: vec![],
Expand Down Expand Up @@ -574,7 +577,10 @@ impl Fri {
Ok(verifier.first_round_partially_revealed_codeword())
}

fn verifier<'stream>(&'stream self, proof_stream: &'stream mut ProofStream) -> FriVerifier {
fn verifier<'stream>(
&'stream self,
proof_stream: &'stream mut ProofStream,
) -> FriVerifier<'stream> {
FriVerifier {
proof_stream,
rounds: vec![],
Expand Down

0 comments on commit 814f5d5

Please sign in to comment.