Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/codegen/src/loop_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<'a, 'b> BlocksInLoopPostOrder<'a, 'b> {
}
}

impl<'a, 'b> Iterator for BlocksInLoopPostOrder<'a, 'b> {
impl Iterator for BlocksInLoopPostOrder<'_, '_> {
type Item = BlockId;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion crates/codegen/src/optim/sccp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ impl<'a, 'i> CellState<'a, 'i> {
}
}

impl<'a, 'i> State for CellState<'a, 'i> {
impl State for CellState<'_, '_> {
fn lookup_val(&mut self, value: ValueId) -> EvalValue {
self.used_val.insert(value);

Expand Down
2 changes: 1 addition & 1 deletion crates/ir/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl<'a> CfgPostOrder<'a> {
}
}

impl<'a> Iterator for CfgPostOrder<'a> {
impl Iterator for CfgPostOrder<'_> {
type Item = BlockId;

fn next(&mut self) -> Option<BlockId> {
Expand Down
2 changes: 1 addition & 1 deletion crates/ir/src/graphviz/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<'a> BlockNode<'a> {
}
}

impl<'a> BlockNode<'a> {
impl BlockNode<'_> {
pub(super) fn label(self) -> label::Text<'static> {
let Self { block, ctx, .. } = self;
let Function { sig, layout, .. } = &ctx.func;
Expand Down
2 changes: 1 addition & 1 deletion crates/ir/src/graphviz/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub(super) struct BlockEdge<'a> {
ctx: &'a FuncWriteCtx<'a>,
}

impl<'a> BlockEdge<'a> {
impl BlockEdge<'_> {
fn label(self) -> Text<'static> {
let Self { from, to, ctx } = self;
let to = to.block;
Expand Down
4 changes: 3 additions & 1 deletion crates/ir/src/inst/inst_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ define_inst_set_base! {
}

/// This trait provides the concrete mapping from `Inst` to corresponding enum
/// variant. All instruction set that are defined by `sonatina_macros::inst_set`
/// variant.
///
/// All instruction set that are defined by `sonatina_macros::inst_set`
/// automatically defines an enum which represents all instructions in the set.
/// e.g.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/ir/src/interpret/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ impl Interpret for Gep {
}

fn align_to(offset: usize, alignment: usize) -> usize {
assert!(alignment & (alignment - 1) == 0);
assert!(alignment.is_power_of_two());
(offset + alignment - 1) & !(alignment - 1)
}
4 changes: 2 additions & 2 deletions crates/ir/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ struct BlockIter<'a> {
blocks: &'a SecondaryMap<BlockId, BlockNode>,
}

impl<'a> Iterator for BlockIter<'a> {
impl Iterator for BlockIter<'_> {
type Item = BlockId;

fn next(&mut self) -> Option<BlockId> {
Expand All @@ -311,7 +311,7 @@ struct InstIter<'a> {
insts: &'a SecondaryMap<InstId, InstNode>,
}

impl<'a> Iterator for InstIter<'a> {
impl Iterator for InstIter<'_> {
type Item = InstId;

fn next(&mut self) -> Option<InstId> {
Expand Down
9 changes: 6 additions & 3 deletions crates/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub fn define_inst_set_base(input: proc_macro::TokenStream) -> proc_macro::Token
}

/// A macro to define an instruction set that is specific to an target arch.
///
/// In sonatina, an InstructionSet is defined as a type that implements
/// `HasInst<{Inst}>` for all `{Inst}` it contains, and also implements
/// `InstSetBase` and `InstSetExt`. This macro automatically implements these
Expand Down Expand Up @@ -69,9 +70,11 @@ pub fn inst_set(
inst_set::define_inst_set(attr, input)
}

/// A procedural macro attribute that facilitates defining a trait with a
/// specific set of instruction types (implementing the `Inst` trait) and
/// automatically implements downcasting functionality for the trait.
/// A procedural macro attribute for instruction set construction.
///
/// Facilitates defining a trait with a specific set of instruction types
/// (implementing the `Inst` trait) and automatically implements downcasting
/// functionality for the trait.
///
/// # Usage
///
Expand Down
2 changes: 1 addition & 1 deletion crates/parser/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl<'i, E> Node<'i, E> {
}
}

impl<'i, E> std::default::Default for Node<'i, E> {
impl<E> std::default::Default for Node<'_, E> {
fn default() -> Self {
Self {
rule: Rule::EOI,
Expand Down
2 changes: 1 addition & 1 deletion crates/verifier/src/error/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<'a> DisplayErrorKind<'a> {
}
}

impl<'a> fmt::Display for DisplayErrorKind<'a> {
impl fmt::Display for DisplayErrorKind<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use ErrorKind::*;
match self.kind {
Expand Down
2 changes: 1 addition & 1 deletion crates/verifier/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'a> Error<'a> {
}
}

impl<'a> fmt::Display for Error<'a> {
impl fmt::Display for Error<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let ErrorData { kind, trace_info } = self.err;
let kind = DisplayErrorKind::new(kind, self.func, self.func_ref);
Expand Down
2 changes: 1 addition & 1 deletion crates/verifier/src/error/trace_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<'a, 'b> DisplayTraceInfo<'a, 'b> {
}
}

impl<'a, 'b> fmt::Display for DisplayTraceInfo<'a, 'b> {
impl fmt::Display for DisplayTraceInfo<'_, '_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let TraceInfo {
block,
Expand Down