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