Skip to content

Commit 771c36c

Browse files
committed
fix
1 parent a3c4707 commit 771c36c

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ squawk-github = { version = "0.0.0", path = "./crates/github" }
3838
collapsible_else_if = "allow"
3939
collapsible_if = "allow"
4040
needless_return = "allow"
41+
if_not_else = "allow"
42+
needless_raw_string_hashes = "allow"
43+
cast_possible_truncation = "allow"
44+
semicolon_if_nothing_returned = "allow"
4145

4246
[profile.dev]
4347
debug = 0

crates/squawk_lexer/src/cursor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::str::Chars;
55
/// Next characters can be peeked via `first` method,
66
/// and position can be shifted forward via `bump` method.
77
/// based on:
8-
/// - https://github.com/rust-lang/rust/blob/d1b7355d3d7b4ead564dbecb1d240fcc74fff21b/compiler/rustc_lexer/src/cursor.rs
9-
/// - https://github.com/astral-sh/ruff/blob/d1079680bb29f6b797b5df15327195300f635f3c/crates/ruff_python_parser/src/lexer/cursor.rs
8+
/// - <https://github.com/rust-lang/rust/blob/d1b7355d3d7b4ead564dbecb1d240fcc74fff21b/compiler/rustc_lexer/src/cursor.rs>
9+
/// - <https://github.com/astral-sh/ruff/blob/d1079680bb29f6b797b5df15327195300f635f3c/crates/ruff_python_parser/src/lexer/cursor.rs>
1010
///
1111
pub(crate) struct Cursor<'a> {
1212
/// Iterator over chars. Slightly faster than a &str.

crates/squawk_lexer/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ const fn is_whitespace(c: char) -> bool {
3232
impl Cursor<'_> {
3333
// see: https://github.com/rust-lang/rust/blob/ba1d7f4a083e6402679105115ded645512a7aea8/compiler/rustc_lexer/src/lib.rs#L339
3434
pub(crate) fn advance_token(&mut self) -> Token {
35-
let first_char = match self.bump() {
36-
Some(c) => c,
37-
None => return Token::new(TokenKind::Eof, 0),
35+
let Some(first_char) = self.bump() else {
36+
return Token::new(TokenKind::Eof, 0);
3837
};
3938
let token_kind = match first_char {
4039
// Slash, comment or block comment.
@@ -418,7 +417,7 @@ impl Cursor<'_> {
418417

419418
// might be the start of our start/end sequence
420419
let mut match_count = 0;
421-
for start_char in start.iter() {
420+
for start_char in &start {
422421
if self.first() == *start_char {
423422
self.bump();
424423
match_count += 1;

crates/squawk_lexer/src/token.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ pub enum TokenKind {
7979
UnknownPrefix,
8080
/// Positional Parameter, e.g., `$1`
8181
///
82-
/// see: https://www.postgresql.org/docs/16/sql-expressions.html#SQL-EXPRESSIONS-PARAMETERS-POSITIONAL
82+
/// see: <https://www.postgresql.org/docs/16/sql-expressions.html#SQL-EXPRESSIONS-PARAMETERS-POSITIONAL>
8383
Param,
8484
/// Quoted Identifier, e.g., `"update"` in `update "my_table" set "a" = 5;`
8585
///
8686
/// These are case-sensitive, unlike [`TokenKind::Ident`]
8787
///
88-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
88+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS>
8989
QuotedIdent { terminated: bool },
9090
}
9191

@@ -122,34 +122,34 @@ pub enum Base {
122122
pub enum LiteralKind {
123123
/// Integer Numeric, e.g., `42`
124124
///
125-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC
125+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC>
126126
Int { base: Base, empty_int: bool },
127127
/// Float Numeric, e.g., `1.925e-3`
128128
///
129-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC
129+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC>
130130
Float { base: Base, empty_exponent: bool },
131131
/// String, e.g., `'foo'`
132132
///
133-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS
133+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS>
134134
Str { terminated: bool },
135135
/// Hexidecimal Bit String, e.g., `X'1FF'`
136136
///
137-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-BIT-STRINGS
137+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-BIT-STRINGS>
138138
ByteStr { terminated: bool },
139139
/// Bit String, e.g., `B'1001'`
140140
///
141-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-BIT-STRINGS
141+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-BIT-STRINGS>
142142
BitStr { terminated: bool },
143143
/// Dollar Quoted String, e.g., `$$Dianne's horse$$`
144144
///
145-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING
145+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING>
146146
DollarQuotedString { terminated: bool },
147147
/// Unicode Escape String, e.g., `U&'d\0061t\+000061'`
148148
///
149-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-UESCAPE
149+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-UESCAPE>
150150
UnicodeEscStr { terminated: bool },
151151
/// Escape String, e.g, `E'foo'`
152152
///
153-
/// see: https://www.postgresql.org/docs/16/sql-syntax-lexical.html
153+
/// see: <https://www.postgresql.org/docs/16/sql-syntax-lexical.html>
154154
EscStr { terminated: bool },
155155
}

0 commit comments

Comments
 (0)