Skip to content

Commit a7b5307

Browse files
committed
fmt
Signed-off-by: Yuhao Su <yuhaosu@outlook.com>
1 parent 3b463a5 commit a7b5307

3 files changed

Lines changed: 15 additions & 22 deletions

File tree

sqllogictest/src/parser.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,9 +1010,9 @@ fn parse_inner<T: ColumnType>(loc: &Location, script: &str) -> Result<Vec<Record
10101010
}
10111011

10121012
// Find the matching ')'
1013-
let close_paren = rest_str.find(')').ok_or_else(|| {
1014-
ParseErrorKind::InvalidLine(line.into()).at(loc.clone())
1015-
})?;
1013+
let close_paren = rest_str
1014+
.find(')')
1015+
.ok_or_else(|| ParseErrorKind::InvalidLine(line.into()).at(loc.clone()))?;
10161016

10171017
// Extract variable names between parentheses
10181018
let vars_str = &rest_str[1..close_paren];
@@ -1036,9 +1036,7 @@ fn parse_inner<T: ColumnType>(loc: &Location, script: &str) -> Result<Vec<Record
10361036
// Check if there's extra content after ')'
10371037
let after_paren = rest_str[close_paren + 1..].trim();
10381038
if !after_paren.is_empty() {
1039-
return Err(
1040-
ParseErrorKind::UnexpectedToken(after_paren.to_string()).at(loc)
1041-
);
1039+
return Err(ParseErrorKind::UnexpectedToken(after_paren.to_string()).at(loc));
10421040
}
10431041

10441042
// Parse the SQL body (following lines until empty line)
@@ -1491,9 +1489,7 @@ SELECT 1
14911489
let records = parse::<DefaultColumnType>(script).unwrap();
14921490
assert_eq!(records.len(), 1);
14931491
match &records[0] {
1494-
Record::Let {
1495-
variables, sql, ..
1496-
} => {
1492+
Record::Let { variables, sql, .. } => {
14971493
assert_eq!(variables, &["id".to_string()]);
14981494
assert_eq!(sql, "SELECT 1");
14991495
}
@@ -1510,9 +1506,7 @@ SELECT 1, 'hello', 42
15101506
let records = parse::<DefaultColumnType>(script).unwrap();
15111507
assert_eq!(records.len(), 1);
15121508
match &records[0] {
1513-
Record::Let {
1514-
variables, sql, ..
1515-
} => {
1509+
Record::Let { variables, sql, .. } => {
15161510
assert_eq!(
15171511
variables,
15181512
&["id".to_string(), "name".to_string(), "value".to_string()]
@@ -1580,10 +1574,7 @@ let (123invalid)
15801574
SELECT 1
15811575
";
15821576
let err = parse::<DefaultColumnType>(script).unwrap_err();
1583-
assert!(matches!(
1584-
err.kind(),
1585-
ParseErrorKind::InvalidVariableName(_)
1586-
));
1577+
assert!(matches!(err.kind(), ParseErrorKind::InvalidVariableName(_)));
15871578
}
15881579

15891580
#[test]

sqllogictest/src/runner.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ type AnyError = Arc<dyn std::error::Error + Send + Sync>;
2727

2828
/// Internal result type for query execution.
2929
enum QueryResult<T: ColumnType> {
30-
Rows { types: Vec<T>, rows: Vec<Vec<String>> },
30+
Rows {
31+
types: Vec<T>,
32+
rows: Vec<Vec<String>>,
33+
},
3134
StatementComplete(u64),
3235
Skipped,
3336
Err(AnyError),
@@ -1373,10 +1376,7 @@ impl<D: AsyncDB, M: MakeConnection<Conn = D>> Runner<D, M> {
13731376
}
13741377
}
13751378
}
1376-
(
1377-
Record::Let { loc, sql, .. },
1378-
RecordOutput::Let { error, .. },
1379-
) => {
1379+
(Record::Let { loc, sql, .. }, RecordOutput::Let { error, .. }) => {
13801380
if let Some(err) = error {
13811381
return Err(TestErrorKind::LetFail {
13821382
sql,

tests/let/let_test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ impl sqllogictest::DB for FakeDB {
5353
}),
5454
// select_rows <n> -> returns n rows (for testing row count validation)
5555
["select_rows", n] => {
56-
let n: usize = n.parse().map_err(|_| FakeDBError("invalid number".into()))?;
56+
let n: usize = n
57+
.parse()
58+
.map_err(|_| FakeDBError("invalid number".into()))?;
5759
let rows = (0..n).map(|i| vec![i.to_string()]).collect();
5860
Ok(DBOutput::Rows {
5961
types: vec![DefaultColumnType::Integer],

0 commit comments

Comments
 (0)