Skip to content

Commit 5cd8e07

Browse files
committed
Improve code formatting and apply pre-commit hooks
Refactor code for better readability with multiline format. Add a Clippy suppression to acknowledge the use of unwrap in tests and ensure pre-commit hooks catch future style issues.
1 parent 885f46e commit 5cd8e07

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/core/parser/lexer.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,12 @@ impl TokenRecognizer for IdentifierRecognizer {
826826
start: pos.clone(),
827827
end: pos,
828828
};
829-
return Err(LexError::new(format!("Default parser does not support non-ASCII characters in identifiers (found \"{ch}\")"),span) );
829+
return Err(LexError::new(
830+
format!(
831+
"Default parser does not support non-ASCII characters in identifiers (found \"{ch}\")"
832+
),
833+
span,
834+
));
830835
}
831836
if ch.is_alphanumeric() || ch == '_' {
832837
identifier.push(ch);
@@ -908,6 +913,7 @@ impl Lexer {
908913

909914
#[cfg(test)]
910915
mod tests {
916+
#![expect(clippy::unwrap_used)]
911917
use super::*;
912918

913919
#[test]
@@ -1196,9 +1202,11 @@ mod tests {
11961202
fn test_unicode_characters() {
11971203
let mut lexer = Lexer::default_for_input("non_asciî");
11981204
assert!(lexer.next_token().is_err());
1199-
assert!(lexer
1200-
.next_token()
1201-
.is_err_and(|LexError { message, .. }| message.contains('î')));
1205+
assert!(
1206+
lexer
1207+
.next_token()
1208+
.is_err_and(|LexError { message, .. }| message.contains('î'))
1209+
);
12021210
}
12031211

12041212
#[test]
@@ -1405,8 +1413,10 @@ mod tests {
14051413
"relation" , "title" , "User" ,
14061414
];
14071415
for identifier in expected_identifiers {
1408-
assert!(token_types
1409-
.contains(&&TokenType::Identifier(identifier.to_owned())));
1416+
assert!(
1417+
token_types
1418+
.contains(&&TokenType::Identifier(identifier.to_owned()))
1419+
);
14101420
}
14111421
}
14121422

0 commit comments

Comments
 (0)