Skip to content

Commit 2e257c5

Browse files
authored
remove empty lines (#12)
1 parent 3df4afd commit 2e257c5

6 files changed

Lines changed: 23 additions & 24 deletions

File tree

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use sqlparser::parser::ParserError;
88
/// and makes function signatures easier to read.
99
pub type Result<T> = result::Result<T, SQLRiteError>;
1010

11-
/// SQLRiteError is an enum with all the standardized errors available for returning
12-
///
11+
/// SQLRiteError is an enum with all the standardized errors available for returning
12+
///
1313
#[derive(Error, Debug, PartialEq)]
1414
pub enum SQLRiteError {
1515
#[error("Not Implemented error: {0}")]

src/sql/db/database.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl Database {
1919
///
2020
/// ```
2121
/// let mut db = sql::db::database::Database::new("my_db".to_string());
22-
/// ```
22+
/// ```
2323
pub fn new(db_name: String) -> Self {
2424
Database {
2525
db_name,
@@ -33,7 +33,7 @@ impl Database {
3333
self.tables.contains_key(&table_name)
3434
}
3535

36-
/// Returns an immutable reference of `sql::db::table::Table` if the database contains a
36+
/// Returns an immutable reference of `sql::db::table::Table` if the database contains a
3737
/// table with the specified key as a table name.
3838
///
3939
pub fn get_table(&self, table_name: String) -> Result<&Table> {
@@ -44,7 +44,7 @@ impl Database {
4444
}
4545
}
4646

47-
/// Returns an mutable reference of `sql::db::table::Table` if the database contains a
47+
/// Returns an mutable reference of `sql::db::table::Table` if the database contains a
4848
/// table with the specified key as a table name.
4949
///
5050
pub fn get_table_mut(&mut self, table_name: String) -> Result<&mut Table> {
@@ -88,7 +88,7 @@ mod tests {
8888
}
8989
let query = ast.pop().unwrap();
9090

91-
let create_query = CreateQuery::new(&query).unwrap();
91+
let create_query = CreateQuery::new(&query).unwrap();
9292
let table_name = &create_query.table_name;
9393
db.tables.insert(table_name.to_string(), Table::new(create_query));
9494

src/sql/db/table.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,12 @@ impl Table {
298298
} else{
299299
if &self.primary_key == &column_names[i]{
300300
continue
301-
}
302-
}
301+
}
302+
}
303303
}else{
304304
if &self.primary_key == &column_names[i]{
305305
continue
306-
}
306+
}
307307
}
308308

309309
// Getting the rows from the column name
@@ -348,11 +348,11 @@ impl Table {
348348
/// Print the table schema to standard output in a pretty formatted way
349349
///
350350
/// # Example
351-
///
351+
///
352352
/// ```
353353
/// let table = Table::new(payload);
354354
/// table.print_table_schema();
355-
///
355+
///
356356
/// Prints to standard output:
357357
/// +-------------+-----------+-------------+--------+----------+
358358
/// | Column Name | Data Type | PRIMARY KEY | UNIQUE | NOT NULL |
@@ -380,11 +380,11 @@ impl Table {
380380
/// Print the table data to standard output in a pretty formatted way
381381
///
382382
/// # Example
383-
///
383+
///
384384
/// ```
385385
/// let db_table = db.get_table_mut(table_name.to_string()).unwrap();
386386
/// db_table.print_table_data();
387-
///
387+
///
388388
/// Prints to standard output:
389389
/// +----+---------+------------------------+
390390
/// | id | name | email |
@@ -429,8 +429,8 @@ impl Table {
429429
if let Some(cell) = &columns.get(i){
430430
print_table_rows[i].add_cell(PrintCell::new(cell));
431431
}else{
432-
print_table_rows[i].add_cell(PrintCell::new(""));
433-
}
432+
print_table_rows[i].add_cell(PrintCell::new(""));
433+
}
434434
}
435435
}
436436

src/sql/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn process_command(query: &str, db: &mut Database) -> Result<String> {
8282
Err(err) => return Err(err),
8383
}
8484
}
85-
Statement::Insert { .. } => {
85+
Statement::Insert { .. } => {
8686
let insert_query = InsertQuery::new(&query);
8787
match insert_query {
8888
Ok(payload) => {
@@ -108,7 +108,6 @@ pub fn process_command(query: &str, db: &mut Database) -> Result<String> {
108108
Ok(()) => {
109109
// No unique constraint violation, moving forward with inserting row
110110
db_table.insert_row(&columns, &value);
111-
112111
}
113112
Err(err) => return Err(SQLRiteError::Internal(format!("Unique key constaint violation: {}",err))),
114113
}
@@ -126,7 +125,7 @@ pub fn process_command(query: &str, db: &mut Database) -> Result<String> {
126125
Err(err) => return Err(err),
127126
}
128127

129-
message = String::from("INSERT Statement executed.")
128+
message = String::from("INSERT Statement executed.")
130129
}
131130
Statement::Query(_query) => message = String::from("SELECT Statement executed."),
132131
// Statement::Insert { .. } => message = String::from("INSERT Statement executed."),

src/sql/parser/create.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ pub struct ParsedColumn {
2020

2121
/// The following structure represents a CREATE TABLE query already parsed
2222
/// and broken down into name and a Vector of `ParsedColumn` metadata
23-
///
23+
///
2424
#[derive(Debug)]
2525
pub struct CreateQuery {
2626
/// name of table after parking and tokenizing of query
27-
pub table_name: String,
27+
pub table_name: String,
2828
/// Vector of `ParsedColumn` type with column metadata information
2929
pub columns: Vec<ParsedColumn>,
3030
}
@@ -55,7 +55,7 @@ impl CreateQuery {
5555
if parsed_columns.iter().any(|col| col.name == name){
5656
return Err(SQLRiteError::Internal(format!("Duplicate column name: {}", &name)))
5757
}
58-
58+
5959
// Parsing each column for it data type
6060
// For now only accepting basic data types
6161
let datatype = match &col.data_type {
@@ -112,7 +112,7 @@ impl CreateQuery {
112112
not_null,
113113
is_unique,
114114
});
115-
115+
116116
}
117117
// TODO: Handle constraints,
118118
// Default value and others.
@@ -164,6 +164,6 @@ mod tests {
164164
}
165165
},
166166
_ => ()
167-
};
167+
};
168168
}
169169
}

src/sql/parser/insert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::error::{Result, SQLRiteError};
44

55
/// The following structure represents a INSERT query already parsed
66
/// and broken down into `table_name` a `Vec<String>` representing the `Columns`
7-
/// and `Vec<Vec<String>>` representing the list of `Rows` to be inserted
7+
/// and `Vec<Vec<String>>` representing the list of `Rows` to be inserted
88
#[derive(Debug)]
99
pub struct InsertQuery {
1010
pub table_name: String,

0 commit comments

Comments
 (0)