Skip to content

Commit

Permalink
update use statements
Browse files Browse the repository at this point in the history
  • Loading branch information
JayWhite2357 committed Sep 21, 2024
1 parent 746a193 commit 7f96b0c
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 9 deletions.
1 change: 1 addition & 0 deletions crates/proof-of-sql-parser/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use thiserror::Error;

/// Errors encountered during the parsing process
Expand Down
4 changes: 3 additions & 1 deletion crates/proof-of-sql-parser/src/identifier.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{sql::IdentifierParser, ParseError, ParseResult};
use alloc::{format, string::ToString};
use arrayvec::ArrayString;
use std::{cmp::Ordering, fmt, ops::Deref, str::FromStr};
use core::{cmp::Ordering, fmt, ops::Deref, str::FromStr};

/// Top-level unique identifier.
#[derive(Debug, PartialEq, Eq, Clone, Hash, Ord, PartialOrd, Copy)]
Expand Down Expand Up @@ -87,6 +88,7 @@ impl AsRef<str> for Identifier {
#[cfg(test)]
mod tests {
use super::*;
use alloc::{borrow::ToOwned, vec, vec::Vec};

#[test]
fn from_str_identifier() {
Expand Down
7 changes: 4 additions & 3 deletions crates/proof-of-sql-parser/src/intermediate_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
***/

use crate::{intermediate_decimal::IntermediateDecimal, posql_time::PoSQLTimestamp, Identifier};
use core::hash::Hash;
use serde::{Deserialize, Serialize};
use std::{
use alloc::{boxed::Box, string::String, vec::Vec};
use core::{
fmt,
fmt::{Display, Formatter},
hash::Hash,
};
use serde::{Deserialize, Serialize};

/// Representation of a SetExpression, a collection of rows, each having one or more columns.
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
Expand Down
1 change: 1 addition & 0 deletions crates/proof-of-sql-parser/src/intermediate_ast_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
utility::*,
SelectStatement,
};
use alloc::{borrow::ToOwned, string::ToString, vec};

// Sting parser tests
#[test]
Expand Down
5 changes: 3 additions & 2 deletions crates/proof-of-sql-parser/src/intermediate_decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//! A decimal must have a decimal point. The lexer does not route
//! whole integers to this contructor.
use crate::intermediate_decimal::IntermediateDecimalError::{LossyCast, OutOfRange, ParseError};
use alloc::string::String;
use bigdecimal::{num_bigint::BigInt, BigDecimal, ParseBigDecimalError, ToPrimitive};
use core::hash::Hash;
use core::{fmt, hash::Hash, str::FromStr};
use serde::{Deserialize, Serialize};
use std::{fmt, str::FromStr};
use thiserror::Error;

/// Errors related to the processing of decimal values in proof-of-sql
Expand Down Expand Up @@ -157,6 +157,7 @@ impl TryFrom<IntermediateDecimal> for i64 {
#[cfg(test)]
mod tests {
use super::*;
use alloc::string::ToString;

#[test]
fn test_valid_decimal_simple() {
Expand Down
1 change: 1 addition & 0 deletions crates/proof-of-sql-parser/src/posql_time/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::{String, ToString};
use serde::{Deserialize, Serialize};
use thiserror::Error;

Expand Down
1 change: 1 addition & 0 deletions crates/proof-of-sql-parser/src/posql_time/timestamp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::{PoSQLTimeUnit, PoSQLTimeZone, PoSQLTimestampError};
use alloc::{format, string::ToString};
use chrono::{offset::LocalResult, DateTime, TimeZone, Utc};
use core::hash::Hash;
use serde::{Deserialize, Serialize};
Expand Down
3 changes: 2 additions & 1 deletion crates/proof-of-sql-parser/src/posql_time/timezone.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::PoSQLTimestampError;
use alloc::{string::ToString, sync::Arc};
use core::fmt;
use serde::{Deserialize, Serialize};
use std::sync::Arc;

/// Captures a timezone from a timestamp query
#[derive(Debug, Clone, Copy, Hash, Serialize, Deserialize, PartialEq, Eq)]
Expand Down Expand Up @@ -75,6 +75,7 @@ impl fmt::Display for PoSQLTimeZone {
#[cfg(test)]
mod timezone_parsing_tests {
use crate::posql_time::timezone;
use alloc::format;

#[test]
fn test_display_fixed_offset_positive() {
Expand Down
6 changes: 5 additions & 1 deletion crates/proof-of-sql-parser/src/resource_id.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//! This file defines the resource identifier type.
use crate::{impl_serde_from_str, sql::ResourceIdParser, Identifier, ParseError, ParseResult};
use std::{
use alloc::{
format,
string::{String, ToString},
};
use core::{
fmt::{self, Display},
str::FromStr,
};
Expand Down
3 changes: 2 additions & 1 deletion crates/proof-of-sql-parser/src/select_statement.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::intermediate_ast::{OrderBy, SetExpression, Slice, TableExpression};
use crate::{sql::SelectStatementParser, Identifier, ParseError, ParseResult, ResourceId};
use alloc::{boxed::Box, string::ToString, vec::Vec};
use core::{fmt, ops::Deref, str::FromStr};
use serde::{Deserialize, Serialize};
use std::{fmt, ops::Deref, str::FromStr};

/// Representation of a select statement, that is, the only type of queries allowed.
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone)]
Expand Down
4 changes: 4 additions & 0 deletions crates/proof-of-sql-parser/src/sql.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ use crate::select_statement;
use crate::identifier;
use lalrpop_util::ParseError::User;
use crate::{intermediate_decimal::IntermediateDecimal, posql_time::PoSQLTimestamp};
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec;
use alloc::vec::Vec;

grammar;

Expand Down
1 change: 1 addition & 0 deletions crates/proof-of-sql-parser/src/utility.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{intermediate_ast::*, Identifier, SelectStatement};
use alloc::{boxed::Box, vec, vec::Vec};

/// Construct an identifier from a str
pub fn ident(name: &str) -> Identifier {
Expand Down

0 comments on commit 7f96b0c

Please sign in to comment.