Skip to content

Commit d0ccd79

Browse files
committed
refactor: collapse if-statement into match guard in buffer.rs
- Replaced nested `if` block with a match arm guard as suggested by clippy::collapsible_match. - Improves code readability and adheres to idiomatic Rust patterns.
1 parent a0e83be commit d0ccd79

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

questdb-rs/src/ingress/buffer.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,13 @@ impl<'a> TableName<'a> {
214214
let mut prev = '\0';
215215
for (index, c) in name.chars().enumerate() {
216216
match c {
217-
'.' => {
218-
if index == 0 || index == name.len() - 1 || prev == '.' {
219-
return Err(error::fmt!(
220-
InvalidName,
221-
concat!("Bad string {:?}: ", "Found invalid dot `.` at position {}."),
222-
name,
223-
index
224-
));
225-
}
217+
'.' if (index == 0 || index == name.len() - 1 || prev == '.') => {
218+
return Err(error::fmt!(
219+
InvalidName,
220+
concat!("Bad string {:?}: ", "Found invalid dot `.` at position {}."),
221+
name,
222+
index
223+
));
226224
}
227225
'?' | ',' | '\'' | '\"' | '\\' | '/' | ':' | ')' | '(' | '+' | '*' | '%' | '~'
228226
| '\r' | '\n' | '\0' | '\u{0001}' | '\u{0002}' | '\u{0003}' | '\u{0004}'

0 commit comments

Comments
 (0)