Skip to content

Commit 5cef3a9

Browse files
authored
code: Solved latest raised clippy warnings - this solves #46 (#47)
* code: Solved latest raised clippy warnings - this solves #46 * code: Forgot to run the Format command
1 parent 13b2a98 commit 5cef3a9

File tree

12 files changed

+37
-36
lines changed

12 files changed

+37
-36
lines changed

canyon_macros/src/utils/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn database_table_name_to_struct_ident(name: &str) -> Ident {
164164
first_iteration = false;
165165
} else {
166166
match char {
167-
n if n == '_' => {
167+
'_' => {
168168
previous_was_underscore = true;
169169
}
170170
char if char.is_ascii_lowercase() => {

canyon_migrations/src/migrations/processor.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
///! File that contains all the datatypes and logic to perform the migrations
2-
///! over a target database
1+
//! File that contains all the datatypes and logic to perform the migrations
2+
//! over a target database
33
use async_trait::async_trait;
44
use canyon_crud::DatabaseType;
55
use regex::Regex;
@@ -95,6 +95,7 @@ impl MigrationsProcessor {
9595
}
9696

9797
// Case when we need to compare the entity with the database contain
98+
#[allow(clippy::unnecessary_unwrap)]
9899
if current_table_metadata.is_some() && current_column_metadata.is_some() {
99100
self.add_modify_or_remove_constraints(
100101
entity_name,
@@ -643,7 +644,7 @@ impl MigrationsHelper {
643644
#[cfg(feature = "mssql")]
644645
fn get_datatype_from_column_metadata(current_column_metadata: &ColumnMetadata) -> String {
645646
// TODO Add all SQL Server text datatypes
646-
if vec!["nvarchar", "varchar"]
647+
if ["nvarchar", "varchar"]
647648
.contains(&current_column_metadata.datatype.to_lowercase().as_str())
648649
{
649650
let varchar_len = match &current_column_metadata.character_maximum_length {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
///! The root crate of the `Canyon-SQL` project.
1+
//! The root crate of the `Canyon-SQL` project.
22
///
33
/// Here it's where all the available functionalities and features
44
/// reaches the top most level, grouping them and making them visible

tests/canyon_integration_tests.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
// Integration tests for the heart of a Canyon-SQL application, the CRUD operations.
2+
///
3+
// This tests will tests mostly the whole source code of Canyon, due to its integration nature
4+
///
5+
// Guide-style: Almost every operation in Canyon is `Result` wrapped (without the) unckecked
6+
// variants of the `find_all` implementations. We will go to directly `.unwrap()` the results
7+
// because, if there's something wrong in the code reported by the tests, we want to *panic*
8+
// and abort the execution.
19
extern crate canyon_sql;
210

311
use std::error::Error;
412

5-
///! Integration tests for the heart of a Canyon-SQL application, the CRUD operations.
6-
///
7-
///! This tests will tests mostly the whole source code of Canyon, due to its integration nature
8-
///
9-
/// Guide-style: Almost every operation in Canyon is `Result` wrapped (without the) unckecked
10-
/// variants of the `find_all` implementations. We will go to directly `.unwrap()` the results
11-
/// because, if there's something wrong in the code reported by the tests, we want to *panic*
12-
/// and abort the execution.
1313
mod crud;
1414
mod migrations;
1515

tests/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
///! Constant values to share across the integration tests
1+
//! Constant values to share across the integration tests
22
33
#[cfg(feature = "postgres")]
44
pub const PSQL_DS: &str = "postgres_docker";

tests/crud/delete_operations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
///! Integration tests for the CRUD operations available in `Canyon` that
2-
///! generates and executes *INSERT* statements
1+
//! Integration tests for the CRUD operations available in `Canyon` that
2+
//! generates and executes *INSERT* statements
33
use canyon_sql::crud::CrudOperations;
44

55
#[cfg(feature = "mysql")]

tests/crud/foreign_key_operations.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
///! Integration tests for the CRUD operations available in `Canyon` that
2-
///! generates and executes *SELECT* statements based on a entity
3-
///! annotated with the `#[foreign_key(... args)]` annotation looking
4-
///! for the related data with some entity `U` that acts as is parent, where `U`
5-
///! impls `ForeignKeyable` (isn't required, but it won't unlock the
6-
///! reverse search features parent -> child, only the child -> parent ones).
1+
// Integration tests for the CRUD operations available in `Canyon` that
2+
// generates and executes *SELECT* statements based on a entity
3+
// annotated with the `#[foreign_key(... args)]` annotation looking
4+
// for the related data with some entity `U` that acts as is parent, where `U`
5+
// impls `ForeignKeyable` (isn't required, but it won't unlock the
6+
// reverse search features parent -> child, only the child -> parent ones).
77
///
8-
///! Names of the foreign key methods are autogenerated for the direct and
9-
///! reverse side of the implementations.
10-
///! For more info: TODO -> Link to the docs of the foreign key chapter
8+
// Names of the foreign key methods are autogenerated for the direct and
9+
// reverse side of the implementations.
10+
// For more info: TODO -> Link to the docs of the foreign key chapter
1111
use canyon_sql::crud::CrudOperations;
1212

1313
#[cfg(feature = "mssql")]

tests/crud/insert_operations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
///! Integration tests for the CRUD operations available in `Canyon` that
2-
///! generates and executes *INSERT* statements
1+
//! Integration tests for the CRUD operations available in `Canyon` that
2+
//! generates and executes *INSERT* statements
33
use canyon_sql::crud::CrudOperations;
44

55
#[cfg(feature = "mysql")]

tests/crud/querybuilder_operations.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use crate::constants::MYSQL_DS;
33
#[cfg(feature = "mssql")]
44
use crate::constants::SQL_SERVER_DS;
55

6-
///! Tests for the QueryBuilder available operations within Canyon.
6+
// Tests for the QueryBuilder available operations within Canyon.
77
///
8-
///! QueryBuilder are the way of obtain more flexibility that with
9-
///! the default generated queries, essentially for build the queries
10-
///! with the SQL filters
8+
// QueryBuilder are the way of obtain more flexibility that with
9+
// the default generated queries, essentially for build the queries
10+
// with the SQL filters
1111
///
1212
use canyon_sql::{
1313
crud::CrudOperations,

tests/crud/select_operations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use crate::constants::MYSQL_DS;
55

66
#[cfg(feature = "mssql")]
77
use crate::constants::SQL_SERVER_DS;
8-
///! Integration tests for the CRUD operations available in `Canyon` that
9-
///! generates and executes *SELECT* statements
8+
// Integration tests for the CRUD operations available in `Canyon` that
9+
/// generates and executes *SELECT* statements
1010
use crate::Error;
1111
use canyon_sql::crud::CrudOperations;
1212

0 commit comments

Comments
 (0)