Skip to content

Commit

Permalink
Fix formatting and linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
timsueberkrueb committed Apr 21, 2024
1 parent ef3dc27 commit ddcd269
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
30 changes: 10 additions & 20 deletions lang/renaming/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ where
P::InfTyp: Rename,
{
fn rename_in_ctx(self, ctx: &mut Ctx) -> Self {
match self {
Prg { decls } => Prg { decls: decls.rename_in_ctx(ctx) },
}
let Prg { decls } = self;

Prg { decls: decls.rename_in_ctx(ctx) }
}
}

Expand Down Expand Up @@ -103,11 +103,8 @@ where
P::InfTyp: Rename,
{
fn rename_in_ctx(self, ctx: &mut Ctx) -> Self {
match self {
Data { info, doc, name, attr, typ, ctors } => {
Data { info, doc, name, attr, typ: typ.rename_in_ctx(ctx), ctors }
}
}
let Data { info, doc, name, attr, typ, ctors } = self;
Data { info, doc, name, attr, typ: typ.rename_in_ctx(ctx), ctors }
}
}

Expand All @@ -119,11 +116,9 @@ where
P::InfTyp: Rename,
{
fn rename_in_ctx(self, ctx: &mut Ctx) -> Self {
match self {
Codata { info, doc, name, attr, typ, dtors } => {
Codata { info, doc, name, attr, typ: typ.rename_in_ctx(ctx), dtors }
}
}
let Codata { info, doc, name, attr, typ, dtors } = self;

Codata { info, doc, name, attr, typ: typ.rename_in_ctx(ctx), dtors }
}
}

Expand Down Expand Up @@ -503,10 +498,7 @@ impl Rename for Option<Span> {

impl<T: Rename> Rename for Option<T> {
fn rename_in_ctx(self, ctx: &mut Ctx) -> Self {
match self {
None => None,
Some(x) => Some(x.rename_in_ctx(ctx)),
}
self.map(|x| x.rename_in_ctx(ctx))
}
}

Expand All @@ -517,7 +509,5 @@ impl<T: Rename> Rename for Vec<T> {
}

impl Rename for () {
fn rename_in_ctx(self, _ctx: &mut Ctx) -> Self {
()
}
fn rename_in_ctx(self, _ctx: &mut Ctx) -> Self {}
}
2 changes: 1 addition & 1 deletion lang/renaming/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ impl<P: Phase> ContextElem<Ctx> for SelfParam<P> {
fn as_element(&self) -> <Ctx as Context>::ElemIn {
self.name.to_owned().unwrap_or_default()
}
}
}
2 changes: 1 addition & 1 deletion lang/renaming/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ mod ast;
mod ctx;
mod util;

pub use ctx::Ctx;
pub use ast::Rename;
pub use ctx::Ctx;

0 comments on commit ddcd269

Please sign in to comment.