Skip to content

Postgres improvements #24

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ on:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run Clippy
run: cargo clippy --all-targets --all-features
12 changes: 6 additions & 6 deletions src/alter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum IndexOption<'a> {
Comment(SString<'a>),
}

impl<'a> Spanned for IndexOption<'a> {
impl Spanned for IndexOption<'_> {
fn span(&self) -> Span {
match &self {
IndexOption::IndexTypeBTree(v) => v.span(),
Expand Down Expand Up @@ -127,7 +127,7 @@ pub struct IndexCol<'a> {
pub size: Option<(u32, Span)>,
}

impl<'a> Spanned for IndexCol<'a> {
impl Spanned for IndexCol<'_> {
fn span(&self) -> Span {
self.name.join_span(&self.size)
}
Expand Down Expand Up @@ -155,7 +155,7 @@ pub enum AlterColumnAction<'a> {
},
}

impl<'a> Spanned for AlterColumnAction<'a> {
impl Spanned for AlterColumnAction<'_> {
fn span(&self) -> Span {
match self {
AlterColumnAction::SetDefault {
Expand Down Expand Up @@ -254,7 +254,7 @@ pub enum AlterSpecification<'a> {
},
}

impl<'a> Spanned for AlterSpecification<'a> {
impl Spanned for AlterSpecification<'_> {
fn span(&self) -> Span {
match &self {
AlterSpecification::AddColumn {
Expand Down Expand Up @@ -659,7 +659,7 @@ pub struct AlterTable<'a> {
pub alter_specifications: Vec<AlterSpecification<'a>>,
}

impl<'a> Spanned for AlterTable<'a> {
impl Spanned for AlterTable<'_> {
fn span(&self) -> Span {
self.alter_span
.join_span(&self.online)
Expand Down Expand Up @@ -757,7 +757,7 @@ fn parse_alter_table<'a>(
Token::Ident(_, Keyword::DEFAULT) => {
let drop_default_span = parser.consume().join_span(&set_span);
AlterColumnAction::DropDefault {
drop_default_span: drop_default_span,
drop_default_span,
}
}
Token::Ident(_, Keyword::NOT) => {
Expand Down
20 changes: 10 additions & 10 deletions src/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub enum TableOption<'a> {
//UNION
}

impl<'a> Spanned for TableOption<'a> {
impl Spanned for TableOption<'_> {
fn span(&self) -> Span {
match &self {
TableOption::AutoExtendSize { identifier, value } => identifier.span().join_span(value),
Expand Down Expand Up @@ -183,7 +183,7 @@ pub enum CreateDefinition<'a> {
},
}

impl<'a> Spanned for CreateDefinition<'a> {
impl Spanned for CreateDefinition<'_> {
fn span(&self) -> Span {
match &self {
CreateDefinition::ColumnDefinition {
Expand Down Expand Up @@ -229,7 +229,7 @@ pub enum CreateOption<'a> {
SqlSecurityDefiner(Span, Span),
SqlSecurityUser(Span, Span),
}
impl<'a> Spanned for CreateOption<'a> {
impl Spanned for CreateOption<'_> {
fn span(&self) -> Span {
match &self {
CreateOption::OrReplace(v) => v.span(),
Expand Down Expand Up @@ -290,7 +290,7 @@ pub struct CreateTable<'a> {
pub options: Vec<TableOption<'a>>,
}

impl<'a> Spanned for CreateTable<'a> {
impl Spanned for CreateTable<'_> {
fn span(&self) -> Span {
self.create_span
.join_span(&self.create_options)
Expand Down Expand Up @@ -345,7 +345,7 @@ pub struct CreateView<'a> {
pub select: Box<Statement<'a>>,
}

impl<'a> Spanned for CreateView<'a> {
impl Spanned for CreateView<'_> {
fn span(&self) -> Span {
self.create_span
.join_span(&self.create_options)
Expand Down Expand Up @@ -465,7 +465,7 @@ pub enum FunctionCharacteristic<'a> {
Comment(SString<'a>),
}

impl<'a> Spanned for FunctionCharacteristic<'a> {
impl Spanned for FunctionCharacteristic<'_> {
fn span(&self) -> Span {
match &self {
FunctionCharacteristic::LanguageSql(v) => v.span(),
Expand Down Expand Up @@ -554,7 +554,7 @@ pub struct CreateFunction<'a> {
pub return_: Option<Box<Statement<'a>>>,
}

impl<'a> Spanned for CreateFunction<'a> {
impl Spanned for CreateFunction<'_> {
fn span(&self) -> Span {
self.create_span
.join_span(&self.create_options)
Expand Down Expand Up @@ -813,7 +813,7 @@ pub struct CreateTrigger<'a> {
pub statement: Box<Statement<'a>>,
}

impl<'a> Spanned for CreateTrigger<'a> {
impl Spanned for CreateTrigger<'_> {
fn span(&self) -> Span {
self.create_span
.join_span(&self.create_options)
Expand Down Expand Up @@ -918,7 +918,7 @@ pub struct CreateTypeEnum<'a> {
pub values: Vec<SString<'a>>,
}

impl<'a> Spanned for CreateTypeEnum<'a> {
impl Spanned for CreateTypeEnum<'_> {
fn span(&self) -> Span {
self.create_span
.join_span(&self.create_options)
Expand Down Expand Up @@ -996,7 +996,7 @@ pub struct CreateIndex<'a> {
pub where_: Option<(Span, Expression<'a>)>,
}

impl<'a> Spanned for CreateIndex<'a> {
impl Spanned for CreateIndex<'_> {
fn span(&self) -> Span {
self.create_span
.join_span(&self.create_options)
Expand Down
6 changes: 3 additions & 3 deletions src/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum DataTypeProperty<'a> {
Check((Span, Box<Expression<'a>>)),
}

impl<'a> Spanned for DataTypeProperty<'a> {
impl Spanned for DataTypeProperty<'_> {
fn span(&self) -> Span {
match &self {
DataTypeProperty::Signed(v) => v.span(),
Expand Down Expand Up @@ -123,7 +123,7 @@ pub enum Type<'a> {
Inet6,
}

impl<'a> OptSpanned for Type<'a> {
impl OptSpanned for Type<'_> {
fn opt_span(&self) -> Option<Span> {
match &self {
Type::Boolean => None,
Expand Down Expand Up @@ -176,7 +176,7 @@ pub struct DataType<'a> {
pub properties: Vec<DataTypeProperty<'a>>,
}

impl<'a> Spanned for DataType<'a> {
impl Spanned for DataType<'_> {
fn span(&self) -> Span {
self.identifier
.join_span(&self.type_)
Expand Down
2 changes: 1 addition & 1 deletion src/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub struct Delete<'a> {
pub returning: Option<(Span, Vec<SelectExpr<'a>>)>,
}

impl<'a> Spanned for Delete<'a> {
impl Spanned for Delete<'_> {
fn span(&self) -> Span {
self.delete_span
.join_span(&self.flags)
Expand Down
18 changes: 9 additions & 9 deletions src/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct DropTable<'a> {
pub cascade: Option<Span>,
}

impl<'a> Spanned for DropTable<'a> {
impl Spanned for DropTable<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.temporary)
Expand Down Expand Up @@ -95,7 +95,7 @@ pub struct DropView<'a> {
pub views: Vec<QualifiedName<'a>>,
}

impl<'a> Spanned for DropView<'a> {
impl Spanned for DropView<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.temporary)
Expand Down Expand Up @@ -135,7 +135,7 @@ pub struct DropDatabase<'a> {
pub database: Identifier<'a>,
}

impl<'a> Spanned for DropDatabase<'a> {
impl Spanned for DropDatabase<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.database_span)
Expand Down Expand Up @@ -173,7 +173,7 @@ pub struct DropEvent<'a> {
pub event: QualifiedName<'a>,
}

impl<'a> Spanned for DropEvent<'a> {
impl Spanned for DropEvent<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.event_span)
Expand Down Expand Up @@ -211,7 +211,7 @@ pub struct DropFunction<'a> {
pub function: QualifiedName<'a>,
}

impl<'a> Spanned for DropFunction<'a> {
impl Spanned for DropFunction<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.function_span)
Expand Down Expand Up @@ -249,7 +249,7 @@ pub struct DropProcedure<'a> {
pub procedure: QualifiedName<'a>,
}

impl<'a> Spanned for DropProcedure<'a> {
impl Spanned for DropProcedure<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.procedure_span)
Expand Down Expand Up @@ -288,7 +288,7 @@ pub struct DropServer<'a> {
pub server: Identifier<'a>,
}

impl<'a> Spanned for DropServer<'a> {
impl Spanned for DropServer<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.server_span)
Expand Down Expand Up @@ -326,7 +326,7 @@ pub struct DropTrigger<'a> {
pub identifier: QualifiedName<'a>,
}

impl<'a> Spanned for DropTrigger<'a> {
impl Spanned for DropTrigger<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.trigger_span)
Expand Down Expand Up @@ -580,7 +580,7 @@ pub struct DropIndex<'a> {
pub on: Option<(Span, QualifiedName<'a>)>,
}

impl<'a> Spanned for DropIndex<'a> {
impl Spanned for DropIndex<'_> {
fn span(&self) -> Span {
self.drop_span
.join_span(&self.index_span)
Expand Down
8 changes: 4 additions & 4 deletions src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ pub enum IdentifierPart<'a> {
Star(Span),
}

impl<'a> Spanned for IdentifierPart<'a> {
impl Spanned for IdentifierPart<'_> {
fn span(&self) -> Span {
match &self {
IdentifierPart::Name(v) => v.span(),
Expand All @@ -301,7 +301,7 @@ pub struct When<'a> {
pub then: Expression<'a>,
}

impl<'a> Spanned for When<'a> {
impl Spanned for When<'_> {
fn span(&self) -> Span {
self.when_span
.join_span(&self.when)
Expand All @@ -317,7 +317,7 @@ pub struct WindowSpec<'a> {
pub order_by: (Span, Vec<(Expression<'a>, OrderFlag)>),
}

impl<'a> Spanned for WindowSpec<'a> {
impl Spanned for WindowSpec<'_> {
fn span(&self) -> Span {
self.order_by.span()
}
Expand Down Expand Up @@ -449,7 +449,7 @@ pub enum Expression<'a> {
},
}

impl<'a> Spanned for Expression<'a> {
impl Spanned for Expression<'_> {
fn span(&self) -> Span {
match &self {
Expression::Binary {
Expand Down
14 changes: 7 additions & 7 deletions src/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,32 @@ pub struct Identifier<'a> {
pub span: Span,
}

impl<'a> PartialEq for Identifier<'a> {
impl PartialEq for Identifier<'_> {
fn eq(&self, other: &Self) -> bool {
self.value == other.value
}
}
impl<'a> Eq for Identifier<'a> {}
impl Eq for Identifier<'_> {}

impl<'a> PartialOrd for Identifier<'a> {
impl PartialOrd for Identifier<'_> {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl<'a> Ord for Identifier<'a> {
impl Ord for Identifier<'_> {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.value.cmp(other.value)
}
}

impl<'a> alloc::fmt::Display for Identifier<'a> {
impl alloc::fmt::Display for Identifier<'_> {
fn fmt(&self, f: &mut alloc::fmt::Formatter<'_>) -> alloc::fmt::Result {
self.value.fmt(f)
}
}

impl<'a> Borrow<str> for Identifier<'a> {
impl Borrow<str> for Identifier<'_> {
fn borrow(&self) -> &str {
self.value
}
Expand All @@ -75,7 +75,7 @@ impl<'a> core::ops::Deref for Identifier<'a> {
}
}

impl<'a> Spanned for Identifier<'a> {
impl Spanned for Identifier<'_> {
fn span(&self) -> Span {
self.span.span()
}
Expand Down
Loading
Loading