Satisfy warnings
This commit is contained in:
parent
3ed3c4e8f8
commit
03e7f10739
14 changed files with 66 additions and 66 deletions
|
|
@ -62,8 +62,8 @@ pub enum Separated<E, S1, S2> {
|
|||
impl<E, S1, S2> HasSpan for Separated<E, S1, S2> {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
Separated::Empty(span) => *span,
|
||||
Separated::NonEmpty { span, .. } => *span,
|
||||
Self::Empty(span) => *span,
|
||||
Self::NonEmpty { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ pub enum Call {
|
|||
impl HasSpan for Call {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
Call::Arg { span, .. } => *span,
|
||||
Call::NoArg { span, .. } => *span,
|
||||
Call::Constr { span, .. } => *span,
|
||||
Self::Arg { span, .. } => *span,
|
||||
Self::NoArg { span, .. } => *span,
|
||||
Self::Constr { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,17 +186,17 @@ impl fmt::Debug for Expr {
|
|||
impl HasSpan for Expr {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
Expr::Lit(lit) => lit.span(),
|
||||
Expr::Call(call) => call.span(),
|
||||
Expr::Field(field) => field.span(),
|
||||
Expr::Var(var) => var.span(),
|
||||
Expr::TableConstr(constr) => constr.span(),
|
||||
Expr::TableDestr(destr) => destr.span(),
|
||||
Expr::FuncDef(def) => def.span(),
|
||||
Expr::Paren { span, .. } => *span,
|
||||
Expr::Neg { span, .. } => *span,
|
||||
Expr::Not { span, .. } => *span,
|
||||
Expr::BinOp { span, .. } => *span,
|
||||
Self::Lit(lit) => lit.span(),
|
||||
Self::Call(call) => call.span(),
|
||||
Self::Field(field) => field.span(),
|
||||
Self::Var(var) => var.span(),
|
||||
Self::TableConstr(constr) => constr.span(),
|
||||
Self::TableDestr(destr) => destr.span(),
|
||||
Self::FuncDef(def) => def.span(),
|
||||
Self::Paren { span, .. } => *span,
|
||||
Self::Neg { span, .. } => *span,
|
||||
Self::Not { span, .. } => *span,
|
||||
Self::BinOp { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,10 +60,10 @@ pub enum Field {
|
|||
impl HasSpan for Field {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
Field::Access { span, .. } => *span,
|
||||
Field::Assign { span, .. } => *span,
|
||||
Field::AccessIdent { span, .. } => *span,
|
||||
Field::AssignIdent { span, .. } => *span,
|
||||
Self::Access { span, .. } => *span,
|
||||
Self::Assign { span, .. } => *span,
|
||||
Self::AccessIdent { span, .. } => *span,
|
||||
Self::AssignIdent { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ pub enum FuncDef {
|
|||
impl HasSpan for FuncDef {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
FuncDef::AnonNoArg { span, .. } => *span,
|
||||
FuncDef::AnonArg { span, .. } => *span,
|
||||
FuncDef::AnonDestr { span, .. } => *span,
|
||||
FuncDef::NamedNoArg { span, .. } => *span,
|
||||
FuncDef::NamedArg { span, .. } => *span,
|
||||
FuncDef::NamedDestr { span, .. } => *span,
|
||||
Self::AnonNoArg { span, .. } => *span,
|
||||
Self::AnonArg { span, .. } => *span,
|
||||
Self::AnonDestr { span, .. } => *span,
|
||||
Self::NamedNoArg { span, .. } => *span,
|
||||
Self::NamedArg { span, .. } => *span,
|
||||
Self::NamedDestr { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ pub enum TableLitElem {
|
|||
impl HasSpan for TableLitElem {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
TableLitElem::Positional(value) => value.span(),
|
||||
TableLitElem::Named { span, .. } => *span,
|
||||
Self::Positional(value) => value.span(),
|
||||
Self::Named { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -187,12 +187,12 @@ impl fmt::Debug for Lit {
|
|||
impl HasSpan for Lit {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
Lit::Nil(span) => *span,
|
||||
Lit::Bool(_, span) => *span,
|
||||
Lit::Builtin(_, span) => *span,
|
||||
Lit::Num(n) => n.span(),
|
||||
Lit::String(s) => s.span(),
|
||||
Lit::Table(t) => t.span(),
|
||||
Self::Nil(span) => *span,
|
||||
Self::Bool(_, span) => *span,
|
||||
Self::Builtin(_, span) => *span,
|
||||
Self::Num(n) => n.span(),
|
||||
Self::String(s) => s.span(),
|
||||
Self::Table(t) => t.span(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ pub enum Program {
|
|||
impl HasSpan for Program {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
Program::Expr { span, .. } => *span,
|
||||
Program::Module { span, .. } => *span,
|
||||
Self::Expr { span, .. } => *span,
|
||||
Self::Module { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ pub enum TableConstrElem {
|
|||
impl HasSpan for TableConstrElem {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
TableConstrElem::Lit(lit) => lit.span(),
|
||||
TableConstrElem::Indexed { span, .. } => *span,
|
||||
Self::Lit(lit) => lit.span(),
|
||||
Self::Indexed { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ pub enum TablePatternElem {
|
|||
impl HasSpan for TablePatternElem {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
TablePatternElem::Positional(ident) => ident.span(),
|
||||
TablePatternElem::Named { span, .. } => *span,
|
||||
Self::Positional(ident) => ident.span(),
|
||||
Self::Named { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ pub enum Var {
|
|||
impl HasSpan for Var {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
Var::Access { span, .. } => *span,
|
||||
Var::Assign { span, .. } => *span,
|
||||
Var::AccessIdent(ident) => ident.span(),
|
||||
Var::AssignIdent { span, .. } => *span,
|
||||
Self::Access { span, .. } => *span,
|
||||
Self::Assign { span, .. } => *span,
|
||||
Self::AccessIdent(ident) => ident.span(),
|
||||
Self::AssignIdent { span, .. } => *span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ impl Suffix {
|
|||
fn into_expr(self, span: Span, expr: Expr) -> Expr {
|
||||
let expr = Box::new(expr);
|
||||
match self {
|
||||
Suffix::CallArg { s0, s1, arg, s2 } => Expr::Call(Call::Arg {
|
||||
Self::CallArg { s0, s1, arg, s2 } => Expr::Call(Call::Arg {
|
||||
expr,
|
||||
s0,
|
||||
s1,
|
||||
|
|
@ -67,14 +67,14 @@ impl Suffix {
|
|||
s2,
|
||||
span,
|
||||
}),
|
||||
Suffix::CallNoArg { s0, s1 } => Expr::Call(Call::NoArg { expr, s0, s1, span }),
|
||||
Suffix::CallConstr { s0, constr } => Expr::Call(Call::Constr {
|
||||
Self::CallNoArg { s0, s1 } => Expr::Call(Call::NoArg { expr, s0, s1, span }),
|
||||
Self::CallConstr { s0, constr } => Expr::Call(Call::Constr {
|
||||
expr,
|
||||
s0,
|
||||
constr,
|
||||
span,
|
||||
}),
|
||||
Suffix::FieldAccess { s0, s1, index, s2 } => Expr::Field(Field::Access {
|
||||
Self::FieldAccess { s0, s1, index, s2 } => Expr::Field(Field::Access {
|
||||
expr,
|
||||
s0,
|
||||
s1,
|
||||
|
|
@ -82,7 +82,7 @@ impl Suffix {
|
|||
s2,
|
||||
span,
|
||||
}),
|
||||
Suffix::FieldAssign {
|
||||
Self::FieldAssign {
|
||||
s0,
|
||||
s1,
|
||||
index,
|
||||
|
|
@ -101,14 +101,14 @@ impl Suffix {
|
|||
value,
|
||||
span,
|
||||
}),
|
||||
Suffix::FieldAccessIdent { s0, s1, ident } => Expr::Field(Field::AccessIdent {
|
||||
Self::FieldAccessIdent { s0, s1, ident } => Expr::Field(Field::AccessIdent {
|
||||
expr,
|
||||
s0,
|
||||
s1,
|
||||
ident,
|
||||
span,
|
||||
}),
|
||||
Suffix::FieldAssignIdent {
|
||||
Self::FieldAssignIdent {
|
||||
s0,
|
||||
s1,
|
||||
ident,
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ impl<E, S1, S2> Separated<E, S1, S2> {
|
|||
FS2: Fn(&'a D, S2) -> DocBuilder<'a, D>,
|
||||
{
|
||||
match self {
|
||||
Separated::Empty(_) => allocator.nil(),
|
||||
Separated::NonEmpty {
|
||||
Self::Empty(_) => allocator.nil(),
|
||||
Self::NonEmpty {
|
||||
first_elem,
|
||||
last_elems,
|
||||
trailing,
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ use crate::ast::Expr;
|
|||
impl<'a, D: DocAllocator<'a>> Pretty<'a, D> for Expr {
|
||||
fn pretty(self, allocator: &'a D) -> DocBuilder<'a, D> {
|
||||
match self {
|
||||
Expr::Lit(lit) => allocator.text("<lit>"),
|
||||
Expr::Call(call) => allocator.text("<call>"),
|
||||
Expr::Field(field) => allocator.text("<field>"),
|
||||
Expr::Var(var) => allocator.text("<var>"),
|
||||
Expr::TableConstr(constr) => allocator.text("<onstr>"),
|
||||
Expr::TableDestr(destr) => allocator.text("<destr>"),
|
||||
Expr::FuncDef(def) => allocator.text("<def>"),
|
||||
Expr::Paren {
|
||||
Self::Lit(lit) => allocator.text("<lit>"),
|
||||
Self::Call(call) => allocator.text("<call>"),
|
||||
Self::Field(field) => allocator.text("<field>"),
|
||||
Self::Var(var) => allocator.text("<var>"),
|
||||
Self::TableConstr(constr) => allocator.text("<onstr>"),
|
||||
Self::TableDestr(destr) => allocator.text("<destr>"),
|
||||
Self::FuncDef(def) => allocator.text("<def>"),
|
||||
Self::Paren {
|
||||
s0,
|
||||
inner,
|
||||
s1,
|
||||
|
|
@ -20,7 +20,7 @@ impl<'a, D: DocAllocator<'a>> Pretty<'a, D> for Expr {
|
|||
} => inner.pretty(allocator).parens(),
|
||||
|
||||
// TODO Check whether parentheses are necessary
|
||||
Expr::Neg {
|
||||
Self::Neg {
|
||||
minus: _,
|
||||
s0,
|
||||
expr,
|
||||
|
|
@ -28,14 +28,14 @@ impl<'a, D: DocAllocator<'a>> Pretty<'a, D> for Expr {
|
|||
} => allocator.text("-").append(expr.pretty(allocator)),
|
||||
|
||||
// TODO Check whether parentheses are necessary
|
||||
Expr::Not {
|
||||
Self::Not {
|
||||
not: _,
|
||||
s0,
|
||||
expr,
|
||||
span: _,
|
||||
} => allocator.text("not ").append(expr.pretty(allocator)),
|
||||
|
||||
Expr::BinOp {
|
||||
Self::BinOp {
|
||||
left,
|
||||
s0,
|
||||
op,
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ use crate::ast::Program;
|
|||
impl<'a, D: DocAllocator<'a>> Pretty<'a, D> for Program {
|
||||
fn pretty(self, allocator: &'a D) -> DocBuilder<'a, D> {
|
||||
match self {
|
||||
Program::Expr {
|
||||
Self::Expr {
|
||||
s0,
|
||||
expr,
|
||||
s1,
|
||||
span: _,
|
||||
} => expr.pretty(allocator),
|
||||
Program::Module {
|
||||
Self::Module {
|
||||
s0,
|
||||
s1,
|
||||
elems,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue