Skip to content

Fix linting errors #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/dialect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,11 @@ mod tests {
dialect: ansi_dialect,
};

assert_eq!(
dialect_of!(generic_holder is GenericDialect | AnsiDialect),
true
);
assert_eq!(dialect_of!(generic_holder is AnsiDialect), false);
assert!(dialect_of!(generic_holder is GenericDialect | AnsiDialect),);
assert!(!dialect_of!(generic_holder is AnsiDialect));

assert_eq!(dialect_of!(ansi_holder is AnsiDialect), true);
assert_eq!(
dialect_of!(ansi_holder is GenericDialect | AnsiDialect),
true
);
assert_eq!(
dialect_of!(ansi_holder is GenericDialect | MsSqlDialect),
false
);
assert!(dialect_of!(ansi_holder is AnsiDialect));
assert!(dialect_of!(ansi_holder is GenericDialect | AnsiDialect),);
assert!(!dialect_of!(ansi_holder is GenericDialect | MsSqlDialect),);
}
}
3 changes: 1 addition & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2358,8 +2358,7 @@ impl<'a> Parser<'a> {
]) // This couldn't possibly be a bad idea
})?
.into_iter()
.filter(|i| i.is_some())
.map(|i| i.unwrap())
.flatten()
.collect();

lateral_views.push(LateralView {
Expand Down
20 changes: 10 additions & 10 deletions tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ fn parse_top_level() {
fn parse_simple_select() {
let sql = "SELECT id, fname, lname FROM customer WHERE id = 1 LIMIT 5";
let select = verified_only_select(sql);
assert_eq!(false, select.distinct);
assert!(!select.distinct);
assert_eq!(3, select.projection.len());
let select = verified_query(sql);
assert_eq!(Some(Expr::Value(number("5"))), select.limit);
Expand All @@ -269,7 +269,7 @@ fn parse_limit_is_not_an_alias() {
fn parse_select_distinct() {
let sql = "SELECT DISTINCT name FROM customer";
let select = verified_only_select(sql);
assert_eq!(true, select.distinct);
assert!(select.distinct);
assert_eq!(
&SelectItem::UnnamedExpr(Expr::Identifier(Ident::new("name"))),
only(&select.projection)
Expand Down Expand Up @@ -1693,8 +1693,8 @@ fn parse_alter_table_drop_column() {
} => {
assert_eq!("tab", name.to_string());
assert_eq!("is_active", column_name.to_string());
assert_eq!(true, if_exists);
assert_eq!(true, cascade);
assert!(if_exists);
assert!(cascade);
}
_ => unreachable!(),
}
Expand Down Expand Up @@ -2928,13 +2928,13 @@ fn parse_drop_table() {
cascade,
purge: _,
} => {
assert_eq!(false, if_exists);
assert!(!if_exists);
assert_eq!(ObjectType::Table, object_type);
assert_eq!(
vec!["foo"],
names.iter().map(ToString::to_string).collect::<Vec<_>>()
);
assert_eq!(false, cascade);
assert!(!cascade);
}
_ => unreachable!(),
}
Expand All @@ -2948,13 +2948,13 @@ fn parse_drop_table() {
cascade,
purge: _,
} => {
assert_eq!(true, if_exists);
assert!(if_exists);
assert_eq!(ObjectType::Table, object_type);
assert_eq!(
vec!["foo", "bar"],
names.iter().map(ToString::to_string).collect::<Vec<_>>()
);
assert_eq!(true, cascade);
assert!(cascade);
}
_ => unreachable!(),
}
Expand Down Expand Up @@ -3389,8 +3389,8 @@ fn parse_create_index() {
assert_eq!("idx_name", name.to_string());
assert_eq!("test", table_name.to_string());
assert_eq!(indexed_columns, columns);
assert_eq!(true, unique);
assert_eq!(true, if_not_exists)
assert!(unique);
assert!(if_not_exists)
}
_ => unreachable!(),
}
Expand Down