Skip to content

Commit

Permalink
chore: fix lifetime lints
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Oct 4, 2024
1 parent b648a8a commit 5dc5c2e
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 53 deletions.
8 changes: 4 additions & 4 deletions assembly/src/assembler/basic_block_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<'a> BasicBlockBuilder<'a> {
}

/// Accessors
impl<'a> BasicBlockBuilder<'a> {
impl BasicBlockBuilder<'_> {
/// Returns a reference to the internal [`MastForestBuilder`].
pub fn mast_forest_builder(&self) -> &MastForestBuilder {
self.mast_forest_builder
Expand All @@ -73,7 +73,7 @@ impl<'a> BasicBlockBuilder<'a> {
}

/// Operations
impl<'a> BasicBlockBuilder<'a> {
impl BasicBlockBuilder<'_> {
/// Adds the specified operation to the list of basic block operations.
pub fn push_op(&mut self, op: Operation) {
self.ops.push(op);
Expand All @@ -96,7 +96,7 @@ impl<'a> BasicBlockBuilder<'a> {
}

/// Decorators
impl<'a> BasicBlockBuilder<'a> {
impl BasicBlockBuilder<'_> {
/// Add the specified decorator to the list of basic block decorators.
pub fn push_decorator(&mut self, decorator: Decorator) -> Result<(), AssemblyError> {
let decorator_id = self.mast_forest_builder.ensure_decorator(decorator)?;
Expand Down Expand Up @@ -159,7 +159,7 @@ impl<'a> BasicBlockBuilder<'a> {
}

/// Span Constructors
impl<'a> BasicBlockBuilder<'a> {
impl BasicBlockBuilder<'_> {
/// Creates and returns a new basic block node from the operations and decorators currently in
/// this builder.
///
Expand Down
8 changes: 4 additions & 4 deletions assembly/src/assembler/module_graph/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl fmt::Debug for ModuleGraph {
#[doc(hidden)]
struct DisplayModuleGraph<'a>(&'a ModuleGraph);

impl<'a> fmt::Debug for DisplayModuleGraph<'a> {
impl fmt::Debug for DisplayModuleGraph<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_set()
.entries(self.0.modules.iter().enumerate().flat_map(|(module_index, m)| {
Expand Down Expand Up @@ -56,7 +56,7 @@ impl<'a> fmt::Debug for DisplayModuleGraph<'a> {
#[doc(hidden)]
struct DisplayModuleGraphNodes<'a>(&'a Vec<WrappedModule>);

impl<'a> fmt::Debug for DisplayModuleGraphNodes<'a> {
impl fmt::Debug for DisplayModuleGraphNodes<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_list()
.entries(self.0.iter().enumerate().flat_map(|(module_index, m)| {
Expand Down Expand Up @@ -111,7 +111,7 @@ struct DisplayModuleGraphNode<'a> {
ty: GraphNodeType,
}

impl<'a> fmt::Debug for DisplayModuleGraphNode<'a> {
impl fmt::Debug for DisplayModuleGraphNode<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Node")
.field("id", &format_args!("{}:{}", &self.module.as_usize(), &self.index.as_usize()))
Expand All @@ -128,7 +128,7 @@ struct DisplayModuleGraphNodeWithEdges<'a> {
out_edges: &'a [GlobalProcedureIndex],
}

impl<'a> fmt::Debug for DisplayModuleGraphNodeWithEdges<'a> {
impl fmt::Debug for DisplayModuleGraphNodeWithEdges<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Edge")
.field(
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/assembler/module_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub enum ProcedureWrapper<'a> {
Info(&'a ProcedureInfo),
}

impl<'a> ProcedureWrapper<'a> {
impl ProcedureWrapper<'_> {
/// Returns the name of the procedure.
pub fn name(&self) -> &ProcedureName {
match self {
Expand Down
4 changes: 2 additions & 2 deletions assembly/src/ast/attribute/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ pub struct AttributeSetOccupiedEntry<'a> {
set: &'a mut AttributeSet,
index: usize,
}
impl<'a> AttributeSetOccupiedEntry<'a> {
impl AttributeSetOccupiedEntry<'_> {
#[inline]
pub fn get(&self) -> &Attribute {
&self.set.attrs[self.index]
Expand Down Expand Up @@ -228,7 +228,7 @@ pub struct AttributeSetVacantEntry<'a> {
key: Ident,
index: usize,
}
impl<'a> AttributeSetVacantEntry<'a> {
impl AttributeSetVacantEntry<'_> {
pub fn insert(self, attr: Attribute) {
if self.key != attr.id() {
self.set.insert(attr);
Expand Down
4 changes: 2 additions & 2 deletions assembly/src/ast/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub trait Visit<T = ()> {
}
}

impl<'a, V, T> Visit<T> for &'a mut V
impl<V, T> Visit<T> for &mut V
where
V: ?Sized + Visit<T>,
{
Expand Down Expand Up @@ -575,7 +575,7 @@ pub trait VisitMut<T = ()> {
}
}

impl<'a, V, T> VisitMut<T> for &'a mut V
impl<V, T> VisitMut<T> for &mut V
where
V: ?Sized + VisitMut<T>,
{
Expand Down
12 changes: 6 additions & 6 deletions assembly/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl Compile for Module {
}
}

impl<'a> Compile for &'a Module {
impl Compile for &Module {
#[inline(always)]
fn compile_with_options(
self,
Expand Down Expand Up @@ -197,7 +197,7 @@ impl Compile for Arc<SourceFile> {
}
}

impl<'a> Compile for &'a str {
impl Compile for &str {
#[inline(always)]
fn compile_with_options(
self,
Expand All @@ -208,7 +208,7 @@ impl<'a> Compile for &'a str {
}
}

impl<'a> Compile for &'a String {
impl Compile for &String {
#[inline(always)]
fn compile_with_options(
self,
Expand Down Expand Up @@ -251,7 +251,7 @@ impl Compile for Box<str> {
}
}

impl<'a> Compile for Cow<'a, str> {
impl Compile for Cow<'_, str> {
#[inline(always)]
fn compile_with_options(
self,
Expand All @@ -265,7 +265,7 @@ impl<'a> Compile for Cow<'a, str> {
// COMPILE IMPLEMENTATIONS FOR BYTES
// ------------------------------------------------------------------------------------------------

impl<'a> Compile for &'a [u8] {
impl Compile for &[u8] {
#[inline]
fn compile_with_options(
self,
Expand Down Expand Up @@ -350,7 +350,7 @@ where
// ------------------------------------------------------------------------------------------------

#[cfg(feature = "std")]
impl<'a> Compile for &'a std::path::Path {
impl Compile for &std::path::Path {
fn compile_with_options(
self,
source_manager: &dyn SourceManager,
Expand Down
10 changes: 5 additions & 5 deletions assembly/src/library/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ impl<'a> LibraryPathComponent<'a> {
}
}

impl<'a> Eq for LibraryPathComponent<'a> {}
impl Eq for LibraryPathComponent<'_> {}

impl<'a> PartialEq for LibraryPathComponent<'a> {
impl PartialEq for LibraryPathComponent<'_> {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Namespace(a), Self::Namespace(b)) => a == b,
Expand All @@ -77,13 +77,13 @@ impl<'a> PartialEq for LibraryPathComponent<'a> {
}
}

impl<'a> PartialEq<str> for LibraryPathComponent<'a> {
impl PartialEq<str> for LibraryPathComponent<'_> {
fn eq(&self, other: &str) -> bool {
self.as_ref().eq(other)
}
}

impl<'a> AsRef<str> for LibraryPathComponent<'a> {
impl AsRef<str> for LibraryPathComponent<'_> {
fn as_ref(&self) -> &str {
match self {
Self::Namespace(ns) => ns.as_str(),
Expand All @@ -92,7 +92,7 @@ impl<'a> AsRef<str> for LibraryPathComponent<'a> {
}
}

impl<'a> fmt::Display for LibraryPathComponent<'a> {
impl fmt::Display for LibraryPathComponent<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(self.as_ref())
}
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ mod module_walker {
}
}

impl<'a> Iterator for WalkModules<'a> {
impl Iterator for WalkModules<'_> {
type Item = Result<ModuleEntry, Report>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion assembly/src/parser/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ pub enum Token<'input> {
Eof,
}

impl<'input> fmt::Display for Token<'input> {
impl fmt::Display for Token<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Token::Add => write!(f, "add"),
Expand Down
4 changes: 2 additions & 2 deletions assembly/src/sema/passes/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<'analyzer> ConstEvalVisitor<'analyzer> {
}
}

impl<'analyzer> ConstEvalVisitor<'analyzer> {
impl ConstEvalVisitor<'_> {
fn eval_const<T>(&mut self, imm: &mut Immediate<T>) -> ControlFlow<()>
where
T: TryFrom<u64>,
Expand Down Expand Up @@ -45,7 +45,7 @@ impl<'analyzer> ConstEvalVisitor<'analyzer> {
}
}

impl<'analyzer> VisitMut for ConstEvalVisitor<'analyzer> {
impl VisitMut for ConstEvalVisitor<'_> {
fn visit_mut_immediate_u8(&mut self, imm: &mut Immediate<u8>) -> ControlFlow<()> {
self.eval_const(imm)
}
Expand Down
4 changes: 2 additions & 2 deletions assembly/src/sema/passes/verify_invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'a> VerifyInvokeTargets<'a> {
}
}

impl<'a> VerifyInvokeTargets<'a> {
impl VerifyInvokeTargets<'_> {
fn resolve_local(&mut self, name: &ProcedureName) -> ControlFlow<()> {
if !self.procedures.contains(name) {
self.analyzer
Expand Down Expand Up @@ -72,7 +72,7 @@ impl<'a> VerifyInvokeTargets<'a> {
}
}

impl<'a> VisitMut for VerifyInvokeTargets<'a> {
impl VisitMut for VerifyInvokeTargets<'_> {
fn visit_mut_inst(&mut self, inst: &mut Span<Instruction>) -> ControlFlow<()> {
let span = inst.span();
match &**inst {
Expand Down
4 changes: 2 additions & 2 deletions core/src/mast/node/basic_block_node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ struct BasicBlockNodePrettyPrint<'a> {
mast_forest: &'a MastForest,
}

impl<'a> PrettyPrint for BasicBlockNodePrettyPrint<'a> {
impl PrettyPrint for BasicBlockNodePrettyPrint<'_> {
#[rustfmt::skip]
fn render(&self) -> crate::prettier::Document {
use crate::prettier::*;
Expand Down Expand Up @@ -295,7 +295,7 @@ impl<'a> PrettyPrint for BasicBlockNodePrettyPrint<'a> {
}
}

impl<'a> fmt::Display for BasicBlockNodePrettyPrint<'a> {
impl fmt::Display for BasicBlockNodePrettyPrint<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use crate::prettier::PrettyPrint;
self.pretty_print(f)
Expand Down
6 changes: 3 additions & 3 deletions core/src/mast/node/call_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ struct CallNodePrettyPrint<'a> {
mast_forest: &'a MastForest,
}

impl<'a> CallNodePrettyPrint<'a> {
impl CallNodePrettyPrint<'_> {
/// Concatenates the provided decorators in a single line. If the list of decorators is not
/// empty, prepends `prepend` and appends `append` to the decorator document.
fn concatenate_decorators(
Expand Down Expand Up @@ -240,7 +240,7 @@ impl<'a> CallNodePrettyPrint<'a> {
}
}

impl<'a> PrettyPrint for CallNodePrettyPrint<'a> {
impl PrettyPrint for CallNodePrettyPrint<'_> {
fn render(&self) -> Document {
let call_or_syscall = {
let callee_digest = self.mast_forest[self.node.callee].digest();
Expand All @@ -265,7 +265,7 @@ impl<'a> PrettyPrint for CallNodePrettyPrint<'a> {
}
}

impl<'a> fmt::Display for CallNodePrettyPrint<'a> {
impl fmt::Display for CallNodePrettyPrint<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use crate::prettier::PrettyPrint;
self.pretty_print(f)
Expand Down
6 changes: 3 additions & 3 deletions core/src/mast/node/dyn_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct DynNodePrettyPrint<'a> {
mast_forest: &'a MastForest,
}

impl<'a> DynNodePrettyPrint<'a> {
impl DynNodePrettyPrint<'_> {
/// Concatenates the provided decorators in a single line. If the list of decorators is not
/// empty, prepends `prepend` and appends `append` to the decorator document.
fn concatenate_decorators(
Expand Down Expand Up @@ -130,7 +130,7 @@ impl<'a> DynNodePrettyPrint<'a> {
}
}

impl<'a> crate::prettier::PrettyPrint for DynNodePrettyPrint<'a> {
impl crate::prettier::PrettyPrint for DynNodePrettyPrint<'_> {
fn render(&self) -> crate::prettier::Document {
let dyn_text = const_text("dyn");

Expand All @@ -144,7 +144,7 @@ impl<'a> crate::prettier::PrettyPrint for DynNodePrettyPrint<'a> {
}
}

impl<'a> fmt::Display for DynNodePrettyPrint<'a> {
impl fmt::Display for DynNodePrettyPrint<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.pretty_print(f)
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/mast/node/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct ExternalNodePrettyPrint<'a> {
mast_forest: &'a MastForest,
}

impl<'a> ExternalNodePrettyPrint<'a> {
impl ExternalNodePrettyPrint<'_> {
/// Concatenates the provided decorators in a single line. If the list of decorators is not
/// empty, prepends `prepend` and appends `append` to the decorator document.
fn concatenate_decorators(
Expand Down Expand Up @@ -128,7 +128,7 @@ impl<'a> ExternalNodePrettyPrint<'a> {
}
}

impl<'a> crate::prettier::PrettyPrint for ExternalNodePrettyPrint<'a> {
impl crate::prettier::PrettyPrint for ExternalNodePrettyPrint<'_> {
fn render(&self) -> crate::prettier::Document {
let external = const_text("external")
+ const_text(".")
Expand All @@ -144,7 +144,7 @@ impl<'a> crate::prettier::PrettyPrint for ExternalNodePrettyPrint<'a> {
}
}

impl<'a> fmt::Display for ExternalNodePrettyPrint<'a> {
impl fmt::Display for ExternalNodePrettyPrint<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use crate::prettier::PrettyPrint;
self.pretty_print(f)
Expand Down
4 changes: 2 additions & 2 deletions core/src/mast/node/join_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct JoinNodePrettyPrint<'a> {
mast_forest: &'a MastForest,
}

impl<'a> PrettyPrint for JoinNodePrettyPrint<'a> {
impl PrettyPrint for JoinNodePrettyPrint<'_> {
#[rustfmt::skip]
fn render(&self) -> crate::prettier::Document {
use crate::prettier::*;
Expand Down Expand Up @@ -195,7 +195,7 @@ impl<'a> PrettyPrint for JoinNodePrettyPrint<'a> {
}
}

impl<'a> fmt::Display for JoinNodePrettyPrint<'a> {
impl fmt::Display for JoinNodePrettyPrint<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use crate::prettier::PrettyPrint;
self.pretty_print(f)
Expand Down
4 changes: 2 additions & 2 deletions core/src/mast/node/loop_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct LoopNodePrettyPrint<'a> {
mast_forest: &'a MastForest,
}

impl<'a> crate::prettier::PrettyPrint for LoopNodePrettyPrint<'a> {
impl crate::prettier::PrettyPrint for LoopNodePrettyPrint<'_> {
fn render(&self) -> crate::prettier::Document {
use crate::prettier::*;

Expand Down Expand Up @@ -175,7 +175,7 @@ impl<'a> crate::prettier::PrettyPrint for LoopNodePrettyPrint<'a> {
}
}

impl<'a> fmt::Display for LoopNodePrettyPrint<'a> {
impl fmt::Display for LoopNodePrettyPrint<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use crate::prettier::PrettyPrint;
self.pretty_print(f)
Expand Down
Loading

0 comments on commit 5dc5c2e

Please sign in to comment.