Skip to content

Commit

Permalink
cargo fmt and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsSR committed Nov 21, 2023
1 parent f8a96f8 commit c9a43aa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
10 changes: 3 additions & 7 deletions src/api/ecdar_api.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
use crate::api::auth::TokenType;
use crate::api::server::server::get_auth_token_request::user_credentials;
use crate::entities::access;

use crate::entities::session::Model;
use chrono::Local;
use regex::Regex;
use sea_orm::SqlErr;
use std::env;

use std::fmt::{Debug, Formatter};
use std::sync::Arc;
use tonic::{Code, Request, Response, Status};

use crate::api::server::server::{ecdar_api_auth_server::EcdarApiAuth, ecdar_api_server::EcdarApi};
use crate::database::access_context::AccessContextTrait;
use crate::database::database_context::DatabaseContextTrait;

Check warning on line 15 in src/api/ecdar_api.rs

View workflow job for this annotation

GitHub Actions / Clippy lint and check

unused import: `crate::database::database_context::DatabaseContextTrait`

warning: unused import: `crate::database::database_context::DatabaseContextTrait` --> src/api/ecdar_api.rs:15:5 | 15 | use crate::database::database_context::DatabaseContextTrait; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
use crate::database::entity_context::EntityContextTrait;

Check warning on line 16 in src/api/ecdar_api.rs

View workflow job for this annotation

GitHub Actions / Clippy lint and check

unused import: `crate::database::entity_context::EntityContextTrait`

warning: unused import: `crate::database::entity_context::EntityContextTrait` --> src/api/ecdar_api.rs:16:5 | 16 | use crate::database::entity_context::EntityContextTrait; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
use crate::database::in_use_context::InUseContextTrait;
use crate::database::model_context::ModelContextTrait;
use crate::database::query_context::QueryContextTrait;
use crate::database::session_context::SessionContextTrait;
use crate::database::user_context::UserContextTrait;
use crate::database::{
access_context::AccessContext, entity_context::EntityContextTrait,
in_use_context::InUseContext, model_context::ModelContext, query_context::QueryContext,
session_context::SessionContext, user_context::UserContext,
};
use crate::entities::user::Model as User;

use super::{
Expand Down
5 changes: 2 additions & 3 deletions src/database/session_context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chrono::{Local, Utc};
use mockall::automock;

use sea_orm::prelude::async_trait::async_trait;
use sea_orm::ActiveValue::{Set, Unchanged};
use sea_orm::{ActiveModelTrait, ColumnTrait, DbErr, EntityTrait, QueryFilter};
Expand Down Expand Up @@ -63,8 +63,7 @@ impl EntityContextTrait<session::Model> for SessionContext {
updated_at: Set(Utc::now().naive_local()),
};

let session = session.insert(&self.db_context.get_connection()).await;
session
session.insert(&self.db_context.get_connection()).await
}

/// Returns a session by searching for its id.
Expand Down
2 changes: 1 addition & 1 deletion src/database/user_context.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::database::database_context::DatabaseContextTrait;
use crate::database::entity_context::EntityContextTrait;
use crate::entities::user;
use mockall::{automock, mock};

use sea_orm::prelude::async_trait::async_trait;
use sea_orm::ActiveValue::{Set, Unchanged};
use sea_orm::{ActiveModelTrait, ColumnTrait, DbErr, EntityTrait, QueryFilter};
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod entities;
mod tests;

use crate::api::reveaal_context::ReveaalContext;
use crate::api::server::server::ecdar_backend_server::EcdarBackend;

use crate::database::access_context::AccessContext;
use crate::database::database_context::{PostgresDatabaseContext, SQLiteDatabaseContext};
use crate::database::in_use_context::InUseContext;
Expand Down
2 changes: 1 addition & 1 deletion src/tests/api/ecdar_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mod ecdar_api {

let mut mock_user_context = MockC::new();

mock_user_context.expect_delete()
mock_user_context.expect_delete().

let api = get_mock_concrete_ecdar_api(Arc::new(mock_user_context)).await;

Check failure on line 47 in src/tests/api/ecdar_api.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

expected identifier, found keyword `let`

Check failure on line 47 in src/tests/api/ecdar_api.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `api`

Expand Down

0 comments on commit c9a43aa

Please sign in to comment.