Skip to content

Commit a29923e

Browse files
fix: resolve clippy too_many_arguments and rustfmt issues
1 parent ecb4e4b commit a29923e

4 files changed

Lines changed: 252 additions & 94 deletions

File tree

crates/remapping/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,7 @@ mod tests {
593593

594594
let result = builder.build();
595595
assert_eq!(result.sources.len(), 1);
596-
assert_eq!(
597-
result.sources_content,
598-
vec![Some("var x = 1;".to_string())]
599-
);
596+
assert_eq!(result.sources_content, vec![Some("var x = 1;".to_string())]);
600597
}
601598

602599
#[test]
@@ -715,10 +712,7 @@ mod tests {
715712
let result = remap(&outer, |_| None);
716713

717714
assert_eq!(result.sources, vec!["a.js"]);
718-
assert_eq!(
719-
result.sources_content,
720-
vec![Some("var a;".to_string())]
721-
);
715+
assert_eq!(result.sources_content, vec![Some("var a;".to_string())]);
722716
let loc = result.original_position_for(0, 0).unwrap();
723717
assert!(loc.name.is_some());
724718
assert_eq!(result.name(loc.name.unwrap()), "fn1");

crates/scopes/src/lib.rs

Lines changed: 95 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,14 @@ mod tests {
897897
// Scope that starts and ends on the same line (column relative)
898898
let info = ScopeInfo {
899899
scopes: vec![Some(OriginalScope {
900-
start: Position { line: 5, column: 10 },
901-
end: Position { line: 5, column: 30 },
900+
start: Position {
901+
line: 5,
902+
column: 10,
903+
},
904+
end: Position {
905+
line: 5,
906+
column: 30,
907+
},
902908
name: None,
903909
kind: None,
904910
is_stack_frame: false,
@@ -913,8 +919,20 @@ mod tests {
913919
let decoded = decode_scopes(&encoded, &names, 1).unwrap();
914920

915921
let scope = decoded.scopes[0].as_ref().unwrap();
916-
assert_eq!(scope.start, Position { line: 5, column: 10 });
917-
assert_eq!(scope.end, Position { line: 5, column: 30 });
922+
assert_eq!(
923+
scope.start,
924+
Position {
925+
line: 5,
926+
column: 10
927+
}
928+
);
929+
assert_eq!(
930+
scope.end,
931+
Position {
932+
line: 5,
933+
column: 30
934+
}
935+
);
918936
}
919937

920938
#[test]
@@ -923,7 +941,10 @@ mod tests {
923941
let info = ScopeInfo {
924942
scopes: vec![Some(OriginalScope {
925943
start: Position { line: 0, column: 0 },
926-
end: Position { line: 10, column: 0 },
944+
end: Position {
945+
line: 10,
946+
column: 0,
947+
},
927948
name: None,
928949
kind: None,
929950
is_stack_frame: false,
@@ -932,7 +953,10 @@ mod tests {
932953
})],
933954
ranges: vec![GeneratedRange {
934955
start: Position { line: 3, column: 5 },
935-
end: Position { line: 3, column: 25 },
956+
end: Position {
957+
line: 3,
958+
column: 25,
959+
},
936960
is_stack_frame: false,
937961
is_hidden: false,
938962
definition: Some(0),
@@ -948,7 +972,13 @@ mod tests {
948972

949973
let range = &decoded.ranges[0];
950974
assert_eq!(range.start, Position { line: 3, column: 5 });
951-
assert_eq!(range.end, Position { line: 3, column: 25 });
975+
assert_eq!(
976+
range.end,
977+
Position {
978+
line: 3,
979+
column: 25
980+
}
981+
);
952982
}
953983

954984
#[test]
@@ -1032,7 +1062,10 @@ mod tests {
10321062
let info = ScopeInfo {
10331063
scopes: vec![Some(OriginalScope {
10341064
start: Position { line: 0, column: 0 },
1035-
end: Position { line: 10, column: 0 },
1065+
end: Position {
1066+
line: 10,
1067+
column: 0,
1068+
},
10361069
name: None,
10371070
kind: None,
10381071
is_stack_frame: false,
@@ -1041,7 +1074,10 @@ mod tests {
10411074
})],
10421075
ranges: vec![GeneratedRange {
10431076
start: Position { line: 0, column: 0 },
1044-
end: Position { line: 10, column: 0 },
1077+
end: Position {
1078+
line: 10,
1079+
column: 0,
1080+
},
10451081
is_stack_frame: false,
10461082
is_hidden: false,
10471083
definition: Some(0),
@@ -1053,7 +1089,10 @@ mod tests {
10531089
},
10541090
SubRangeBinding {
10551091
expression: Some("b".to_string()),
1056-
from: Position { line: 0, column: 15 },
1092+
from: Position {
1093+
line: 0,
1094+
column: 15,
1095+
},
10571096
},
10581097
])],
10591098
children: vec![],
@@ -1068,7 +1107,13 @@ mod tests {
10681107
Binding::SubRanges(subs) => {
10691108
assert_eq!(subs.len(), 2);
10701109
assert_eq!(subs[0].from, Position { line: 0, column: 0 });
1071-
assert_eq!(subs[1].from, Position { line: 0, column: 15 });
1110+
assert_eq!(
1111+
subs[1].from,
1112+
Position {
1113+
line: 0,
1114+
column: 15
1115+
}
1116+
);
10721117
}
10731118
other => panic!("expected SubRanges, got {other:?}"),
10741119
}
@@ -1079,7 +1124,10 @@ mod tests {
10791124
let info = ScopeInfo {
10801125
scopes: vec![Some(OriginalScope {
10811126
start: Position { line: 0, column: 0 },
1082-
end: Position { line: 20, column: 0 },
1127+
end: Position {
1128+
line: 20,
1129+
column: 0,
1130+
},
10831131
name: None,
10841132
kind: None,
10851133
is_stack_frame: false,
@@ -1088,7 +1136,10 @@ mod tests {
10881136
})],
10891137
ranges: vec![GeneratedRange {
10901138
start: Position { line: 0, column: 0 },
1091-
end: Position { line: 20, column: 0 },
1139+
end: Position {
1140+
line: 20,
1141+
column: 0,
1142+
},
10921143
is_stack_frame: false,
10931144
is_hidden: false,
10941145
definition: Some(0),
@@ -1233,11 +1284,7 @@ mod tests {
12331284
name: None,
12341285
kind: None,
12351286
is_stack_frame: false,
1236-
variables: vec![
1237-
"a".to_string(),
1238-
"b".to_string(),
1239-
"c".to_string(),
1240-
],
1287+
variables: vec!["a".to_string(), "b".to_string(), "c".to_string()],
12411288
children: vec![],
12421289
})],
12431290
ranges: vec![GeneratedRange {
@@ -1669,7 +1716,10 @@ mod tests {
16691716
ranges: vec![
16701717
GeneratedRange {
16711718
start: Position { line: 0, column: 5 },
1672-
end: Position { line: 0, column: 50 },
1719+
end: Position {
1720+
line: 0,
1721+
column: 50,
1722+
},
16731723
is_stack_frame: false,
16741724
is_hidden: false,
16751725
definition: None,
@@ -1701,10 +1751,7 @@ mod tests {
17011751
let decoded = decode_scopes(&encoded, &names, 0).unwrap();
17021752

17031753
assert_eq!(decoded.ranges.len(), 2);
1704-
assert_eq!(
1705-
decoded.ranges[0].start,
1706-
Position { line: 0, column: 5 }
1707-
);
1754+
assert_eq!(decoded.ranges[0].start, Position { line: 0, column: 5 });
17081755
assert_eq!(
17091756
decoded.ranges[0].end,
17101757
Position {
@@ -1742,11 +1789,7 @@ mod tests {
17421789
name: None,
17431790
kind: None,
17441791
is_stack_frame: false,
1745-
variables: vec![
1746-
"alpha".to_string(),
1747-
"beta".to_string(),
1748-
"gamma".to_string(),
1749-
],
1792+
variables: vec!["alpha".to_string(), "beta".to_string(), "gamma".to_string()],
17501793
children: vec![OriginalScope {
17511794
start: Position { line: 2, column: 0 },
17521795
end: Position {
@@ -1903,10 +1946,7 @@ mod tests {
19031946
line: 45,
19041947
column: 2,
19051948
}),
1906-
bindings: vec![
1907-
Binding::Expression("_a".to_string()),
1908-
Binding::Unavailable,
1909-
],
1949+
bindings: vec![Binding::Expression("_a".to_string()), Binding::Unavailable],
19101950
children: vec![],
19111951
},
19121952
GeneratedRange {
@@ -1998,10 +2038,7 @@ mod tests {
19982038
}
19992039
other => panic!("expected SubRanges, got {other:?}"),
20002040
}
2001-
assert_eq!(
2002-
mul_range.bindings[1],
2003-
Binding::Expression("_y".to_string())
2004-
);
2041+
assert_eq!(mul_range.bindings[1], Binding::Expression("_y".to_string()));
20052042
}
20062043

20072044
#[test]
@@ -2013,15 +2050,21 @@ mod tests {
20132050
scopes: vec![],
20142051
ranges: vec![GeneratedRange {
20152052
start: Position { line: 0, column: 0 },
2016-
end: Position { line: 5, column: 50 },
2053+
end: Position {
2054+
line: 5,
2055+
column: 50,
2056+
},
20172057
is_stack_frame: false,
20182058
is_hidden: false,
20192059
definition: None,
20202060
call_site: None,
20212061
bindings: vec![],
20222062
children: vec![GeneratedRange {
20232063
start: Position { line: 2, column: 0 },
2024-
end: Position { line: 5, column: 30 },
2064+
end: Position {
2065+
line: 5,
2066+
column: 30,
2067+
},
20252068
is_stack_frame: false,
20262069
is_hidden: false,
20272070
definition: None,
@@ -2037,9 +2080,21 @@ mod tests {
20372080
let decoded = decode_scopes(&encoded, &names, 0).unwrap();
20382081

20392082
let outer = &decoded.ranges[0];
2040-
assert_eq!(outer.end, Position { line: 5, column: 50 });
2083+
assert_eq!(
2084+
outer.end,
2085+
Position {
2086+
line: 5,
2087+
column: 50
2088+
}
2089+
);
20412090
let inner = &outer.children[0];
2042-
assert_eq!(inner.end, Position { line: 5, column: 30 });
2091+
assert_eq!(
2092+
inner.end,
2093+
Position {
2094+
line: 5,
2095+
column: 30
2096+
}
2097+
);
20432098
}
20442099

20452100
#[test]

0 commit comments

Comments
 (0)