Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcnn committed Oct 20, 2023
1 parent 71ffbd6 commit 0d0566a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion hir/src/parser/ast/block.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{Ident, Type, };
use super::*;
use crate::{Ident, Type};

const INDENT: &str = " ";

Expand Down
2 changes: 1 addition & 1 deletion hir/src/parser/ast/functions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{ArgumentPurpose, ArgumentExtension, CallConv, FunctionIdent, Type, };
use super::*;
use crate::{ArgumentExtension, ArgumentPurpose, CallConv, FunctionIdent, Type};

/// The possible visibilities of a function
pub enum Visibility {
Expand Down
2 changes: 1 addition & 1 deletion hir/src/parser/ast/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::fmt;

use miden_diagnostics::{SourceSpan, Spanned};

use crate::{Ident, Linkage, Type, };
use super::*;
use crate::{Ident, Linkage, Type};

/// This is a type alias used to clarify that an identifier refers to a global variable
pub type GlobalVarId = Ident;
Expand Down
2 changes: 1 addition & 1 deletion hir/src/parser/ast/instruction.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{FunctionIdent, Ident, Overflow, Type, };
use super::*;
use crate::{FunctionIdent, Ident, Overflow, Type};

/// Represents a value in Miden IR.
///
Expand Down
24 changes: 10 additions & 14 deletions hir/src/parser/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,7 @@ where

if self.skip_ident() {
Token::FuncIdent(Symbol::intern(self.slice()))
}
else {
} else {
Token::from_keyword_or_ident(self.slice())
}
}
Expand All @@ -904,8 +903,7 @@ where

if self.skip_ident() {
Token::FuncIdent(Symbol::intern(self.slice()))
}
else {
} else {
Token::Ident(Symbol::intern(self.slice()))
}
}
Expand All @@ -917,20 +915,18 @@ where
match self.read() {
'_' => self.skip(),
'0'..='9' => self.skip(),
':' => {
match self.peek() {
':' => {
func_ident = true;
self.skip();
self.skip()
},
_ => break,
':' => match self.peek() {
':' => {
func_ident = true;
self.skip();
self.skip()
}
}
_ => break,
},
c if c.is_ascii_alphabetic() => self.skip(),
_ => break,
}
};
}
func_ident
}

Expand Down
9 changes: 3 additions & 6 deletions hir/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,10 @@ fn write_operands(
Instruction::Ret(Ret { args, .. }) => {
if args.len(pool) > 0 {
write!(w, " ({})", DisplayValues(args.as_slice(pool)))
}
else {
} else {
Ok(())
}
},
}
Instruction::RetImm(RetImm { arg, .. }) => write!(w, " {arg}"),
Instruction::Call(Call { callee, args, .. }) => {
write!(w, " {}({})", callee, DisplayValues(args.as_slice(pool)))
Expand All @@ -197,9 +196,7 @@ fn write_operands(
write_block_args(w, else_dest.1.as_slice(pool))
}
Instruction::Br(Br {
destination,
args,
..
destination, args, ..
}) => {
write!(w, " {}", destination)?;
write_block_args(w, args.as_slice(pool))
Expand Down

0 comments on commit 0d0566a

Please sign in to comment.