Skip to content

Commit

Permalink
code: Solved latest raised clippy warnings - this solves #46 (#47)
Browse files Browse the repository at this point in the history
* code: Solved latest raised clippy warnings - this solves #46

* code: Forgot to run the Format command
  • Loading branch information
Pylyv authored Dec 10, 2023
1 parent 13b2a98 commit 5cef3a9
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion canyon_macros/src/utils/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub fn database_table_name_to_struct_ident(name: &str) -> Ident {
first_iteration = false;
} else {
match char {
n if n == '_' => {
'_' => {
previous_was_underscore = true;
}
char if char.is_ascii_lowercase() => {
Expand Down
7 changes: 4 additions & 3 deletions canyon_migrations/src/migrations/processor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///! File that contains all the datatypes and logic to perform the migrations
///! over a target database
//! File that contains all the datatypes and logic to perform the migrations
//! over a target database
use async_trait::async_trait;
use canyon_crud::DatabaseType;
use regex::Regex;
Expand Down Expand Up @@ -95,6 +95,7 @@ impl MigrationsProcessor {
}

// Case when we need to compare the entity with the database contain
#[allow(clippy::unnecessary_unwrap)]
if current_table_metadata.is_some() && current_column_metadata.is_some() {
self.add_modify_or_remove_constraints(
entity_name,
Expand Down Expand Up @@ -643,7 +644,7 @@ impl MigrationsHelper {
#[cfg(feature = "mssql")]
fn get_datatype_from_column_metadata(current_column_metadata: &ColumnMetadata) -> String {
// TODO Add all SQL Server text datatypes
if vec!["nvarchar", "varchar"]
if ["nvarchar", "varchar"]
.contains(&current_column_metadata.datatype.to_lowercase().as_str())
{
let varchar_len = match &current_column_metadata.character_maximum_length {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///! The root crate of the `Canyon-SQL` project.
//! The root crate of the `Canyon-SQL` project.
///
/// Here it's where all the available functionalities and features
/// reaches the top most level, grouping them and making them visible
Expand Down
16 changes: 8 additions & 8 deletions tests/canyon_integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Integration tests for the heart of a Canyon-SQL application, the CRUD operations.
///
// This tests will tests mostly the whole source code of Canyon, due to its integration nature
///
// Guide-style: Almost every operation in Canyon is `Result` wrapped (without the) unckecked
// variants of the `find_all` implementations. We will go to directly `.unwrap()` the results
// because, if there's something wrong in the code reported by the tests, we want to *panic*
// and abort the execution.
extern crate canyon_sql;

use std::error::Error;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/constants.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///! Constant values to share across the integration tests
//! Constant values to share across the integration tests
#[cfg(feature = "postgres")]
pub const PSQL_DS: &str = "postgres_docker";
Expand Down
4 changes: 2 additions & 2 deletions tests/crud/delete_operations.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///! Integration tests for the CRUD operations available in `Canyon` that
///! generates and executes *INSERT* statements
//! Integration tests for the CRUD operations available in `Canyon` that
//! generates and executes *INSERT* statements
use canyon_sql::crud::CrudOperations;

#[cfg(feature = "mysql")]
Expand Down
18 changes: 9 additions & 9 deletions tests/crud/foreign_key_operations.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
///! Integration tests for the CRUD operations available in `Canyon` that
///! generates and executes *SELECT* statements based on a entity
///! annotated with the `#[foreign_key(... args)]` annotation looking
///! for the related data with some entity `U` that acts as is parent, where `U`
///! impls `ForeignKeyable` (isn't required, but it won't unlock the
///! reverse search features parent -> child, only the child -> parent ones).
// Integration tests for the CRUD operations available in `Canyon` that
// generates and executes *SELECT* statements based on a entity
// annotated with the `#[foreign_key(... args)]` annotation looking
// for the related data with some entity `U` that acts as is parent, where `U`
// impls `ForeignKeyable` (isn't required, but it won't unlock the
// reverse search features parent -> child, only the child -> parent ones).
///
///! Names of the foreign key methods are autogenerated for the direct and
///! reverse side of the implementations.
///! For more info: TODO -> Link to the docs of the foreign key chapter
// Names of the foreign key methods are autogenerated for the direct and
// reverse side of the implementations.
// For more info: TODO -> Link to the docs of the foreign key chapter
use canyon_sql::crud::CrudOperations;

#[cfg(feature = "mssql")]
Expand Down
4 changes: 2 additions & 2 deletions tests/crud/insert_operations.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///! Integration tests for the CRUD operations available in `Canyon` that
///! generates and executes *INSERT* statements
//! Integration tests for the CRUD operations available in `Canyon` that
//! generates and executes *INSERT* statements
use canyon_sql::crud::CrudOperations;

#[cfg(feature = "mysql")]
Expand Down
8 changes: 4 additions & 4 deletions tests/crud/querybuilder_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use crate::constants::MYSQL_DS;
#[cfg(feature = "mssql")]
use crate::constants::SQL_SERVER_DS;

///! Tests for the QueryBuilder available operations within Canyon.
// Tests for the QueryBuilder available operations within Canyon.
///
///! QueryBuilder are the way of obtain more flexibility that with
///! the default generated queries, essentially for build the queries
///! with the SQL filters
// QueryBuilder are the way of obtain more flexibility that with
// the default generated queries, essentially for build the queries
// with the SQL filters
///
use canyon_sql::{
crud::CrudOperations,
Expand Down
4 changes: 2 additions & 2 deletions tests/crud/select_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::constants::MYSQL_DS;

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

Expand Down
4 changes: 2 additions & 2 deletions tests/crud/update_operations.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::tests_models::league::*;
///! Integration tests for the CRUD operations available in `Canyon` that
///! generates and executes *UPDATE* statements
// Integration tests for the CRUD operations available in `Canyon` that
/// generates and executes *UPDATE* statements
use canyon_sql::crud::CrudOperations;

#[cfg(feature = "mysql")]
Expand Down
2 changes: 1 addition & 1 deletion tests/migrations/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(unused_imports)]
use crate::constants;
///! Integration tests for the migrations feature of `Canyon-SQL`
/// Integration tests for the migrations feature of `Canyon-SQL`
use canyon_sql::crud::Transaction;
#[cfg(feature = "migrations")]
use canyon_sql::migrations::handler::Migrations;
Expand Down

0 comments on commit 5cef3a9

Please sign in to comment.