Skip to content

Commit

Permalink
Don't use debug_tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Jun 23, 2024
1 parent 662c58f commit 5751cb3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 65 deletions.
104 changes: 52 additions & 52 deletions examples/calc/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,25 +378,25 @@ fn parse_print() {
let expected = expect_test::expect![[r#"
(
Program {
[salsa id]: 0,
[salsa id]: Id(0),
statements: [
Statement {
span: Span {
[salsa id]: 4,
[salsa id]: Id(4),
start: 0,
end: 11,
},
data: Print(
Expression {
span: Span {
[salsa id]: 3,
[salsa id]: Id(3),
start: 6,
end: 11,
},
data: Op(
Expression {
span: Span {
[salsa id]: 0,
[salsa id]: Id(0),
start: 6,
end: 7,
},
Expand All @@ -409,7 +409,7 @@ fn parse_print() {
Add,
Expression {
span: Span {
[salsa id]: 2,
[salsa id]: Id(2),
start: 10,
end: 11,
},
Expand Down Expand Up @@ -445,66 +445,66 @@ fn parse_example() {
let expected = expect_test::expect![[r#"
(
Program {
[salsa id]: 0,
[salsa id]: Id(0),
statements: [
Statement {
span: Span {
[salsa id]: 9,
[salsa id]: Id(9),
start: 13,
end: 57,
},
data: Function(
Function {
[salsa id]: 0,
[salsa id]: Id(0),
name: FunctionId {
[salsa id]: 0,
[salsa id]: Id(0),
text: "area_rectangle",
},
name_span: Span {
[salsa id]: 0,
[salsa id]: Id(0),
start: 16,
end: 30,
},
args: [
VariableId {
[salsa id]: 0,
[salsa id]: Id(0),
text: "w",
},
VariableId {
[salsa id]: 1,
[salsa id]: Id(1),
text: "h",
},
],
body: Expression {
span: Span {
[salsa id]: 8,
[salsa id]: Id(8),
start: 39,
end: 57,
},
data: Op(
Expression {
span: Span {
[salsa id]: 5,
[salsa id]: Id(5),
start: 39,
end: 41,
},
data: Variable(
VariableId {
[salsa id]: 0,
[salsa id]: Id(0),
text: "w",
},
),
},
Multiply,
Expression {
span: Span {
[salsa id]: 7,
[salsa id]: Id(7),
start: 43,
end: 57,
},
data: Variable(
VariableId {
[salsa id]: 1,
[salsa id]: Id(1),
text: "h",
},
),
Expand All @@ -516,45 +516,45 @@ fn parse_example() {
},
Statement {
span: Span {
[salsa id]: 21,
[salsa id]: Id(21),
start: 57,
end: 102,
},
data: Function(
Function {
[salsa id]: 1,
[salsa id]: Id(1),
name: FunctionId {
[salsa id]: 1,
[salsa id]: Id(1),
text: "area_circle",
},
name_span: Span {
[salsa id]: 10,
[salsa id]: Id(10),
start: 60,
end: 71,
},
args: [
VariableId {
[salsa id]: 2,
[salsa id]: Id(2),
text: "r",
},
],
body: Expression {
span: Span {
[salsa id]: 20,
[salsa id]: Id(20),
start: 77,
end: 102,
},
data: Op(
Expression {
span: Span {
[salsa id]: 17,
[salsa id]: Id(17),
start: 77,
end: 86,
},
data: Op(
Expression {
span: Span {
[salsa id]: 14,
[salsa id]: Id(14),
start: 77,
end: 81,
},
Expand All @@ -567,13 +567,13 @@ fn parse_example() {
Multiply,
Expression {
span: Span {
[salsa id]: 16,
[salsa id]: Id(16),
start: 84,
end: 86,
},
data: Variable(
VariableId {
[salsa id]: 2,
[salsa id]: Id(2),
text: "r",
},
),
Expand All @@ -583,13 +583,13 @@ fn parse_example() {
Multiply,
Expression {
span: Span {
[salsa id]: 19,
[salsa id]: Id(19),
start: 88,
end: 102,
},
data: Variable(
VariableId {
[salsa id]: 2,
[salsa id]: Id(2),
text: "r",
},
),
Expand All @@ -601,26 +601,26 @@ fn parse_example() {
},
Statement {
span: Span {
[salsa id]: 28,
[salsa id]: Id(28),
start: 102,
end: 141,
},
data: Print(
Expression {
span: Span {
[salsa id]: 27,
[salsa id]: Id(27),
start: 108,
end: 128,
},
data: Call(
FunctionId {
[salsa id]: 0,
[salsa id]: Id(0),
text: "area_rectangle",
},
[
Expression {
span: Span {
[salsa id]: 23,
[salsa id]: Id(23),
start: 123,
end: 124,
},
Expand All @@ -632,7 +632,7 @@ fn parse_example() {
},
Expression {
span: Span {
[salsa id]: 25,
[salsa id]: Id(25),
start: 126,
end: 127,
},
Expand All @@ -649,26 +649,26 @@ fn parse_example() {
},
Statement {
span: Span {
[salsa id]: 33,
[salsa id]: Id(33),
start: 141,
end: 174,
},
data: Print(
Expression {
span: Span {
[salsa id]: 32,
[salsa id]: Id(32),
start: 147,
end: 161,
},
data: Call(
FunctionId {
[salsa id]: 1,
[salsa id]: Id(1),
text: "area_circle",
},
[
Expression {
span: Span {
[salsa id]: 30,
[salsa id]: Id(30),
start: 159,
end: 160,
},
Expand All @@ -685,21 +685,21 @@ fn parse_example() {
},
Statement {
span: Span {
[salsa id]: 38,
[salsa id]: Id(38),
start: 174,
end: 195,
},
data: Print(
Expression {
span: Span {
[salsa id]: 37,
[salsa id]: Id(37),
start: 180,
end: 186,
},
data: Op(
Expression {
span: Span {
[salsa id]: 34,
[salsa id]: Id(34),
start: 180,
end: 182,
},
Expand All @@ -712,7 +712,7 @@ fn parse_example() {
Multiply,
Expression {
span: Span {
[salsa id]: 36,
[salsa id]: Id(36),
start: 185,
end: 186,
},
Expand Down Expand Up @@ -741,7 +741,7 @@ fn parse_error() {
let expected = expect_test::expect![[r#"
(
Program {
[salsa id]: 0,
[salsa id]: Id(0),
statements: [],
},
[
Expand All @@ -763,32 +763,32 @@ fn parse_precedence() {
let expected = expect_test::expect![[r#"
(
Program {
[salsa id]: 0,
[salsa id]: Id(0),
statements: [
Statement {
span: Span {
[salsa id]: 10,
[salsa id]: Id(10),
start: 0,
end: 19,
},
data: Print(
Expression {
span: Span {
[salsa id]: 9,
[salsa id]: Id(9),
start: 6,
end: 19,
},
data: Op(
Expression {
span: Span {
[salsa id]: 6,
[salsa id]: Id(6),
start: 6,
end: 16,
},
data: Op(
Expression {
span: Span {
[salsa id]: 0,
[salsa id]: Id(0),
start: 6,
end: 7,
},
Expand All @@ -801,14 +801,14 @@ fn parse_precedence() {
Add,
Expression {
span: Span {
[salsa id]: 5,
[salsa id]: Id(5),
start: 10,
end: 15,
},
data: Op(
Expression {
span: Span {
[salsa id]: 2,
[salsa id]: Id(2),
start: 10,
end: 11,
},
Expand All @@ -821,7 +821,7 @@ fn parse_precedence() {
Multiply,
Expression {
span: Span {
[salsa id]: 4,
[salsa id]: Id(4),
start: 14,
end: 15,
},
Expand All @@ -838,7 +838,7 @@ fn parse_precedence() {
Add,
Expression {
span: Span {
[salsa id]: 8,
[salsa id]: Id(8),
start: 18,
end: 19,
},
Expand Down
2 changes: 1 addition & 1 deletion src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Id {

impl std::fmt::Debug for Id {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("Id").field(&self.as_u32()).finish()
write!(f, "Id({})", self.as_u32())
}
}

Expand Down
Loading

0 comments on commit 5751cb3

Please sign in to comment.