Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sabotack committed Nov 28, 2023
1 parent 9270e02 commit 62dc3c4
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/api/ecdar_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ impl EcdarApi for ConcreteEcdarApi {
}

async fn update_model(
&self,
request: Request<UpdateModelRequest>
)-> Result<Response<()>, Status> {
&self,
request: Request<UpdateModelRequest>,
) -> Result<Response<()>, Status> {
let message = request.get_ref().clone();
let uid = request
.uid()
Expand All @@ -176,7 +176,11 @@ impl EcdarApi for ConcreteEcdarApi {
};

// Check if the user has access to the model
let access = match self.access_context.get_access_by_uid_and_model_id(uid, model.id).await {
let access = match self

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

View workflow job for this annotation

GitHub Actions / Clippy lint and check

unused variable: `access`

warning: unused variable: `access` --> src/api/ecdar_api.rs:179:13 | 179 | let access = match self | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_access` | = note: `#[warn(unused_variables)]` on by default

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

View workflow job for this annotation

GitHub Actions / Clippy lint and check

unused variable: `access`

warning: unused variable: `access` --> src/api/ecdar_api.rs:179:13 | 179 | let access = match self | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_access` | = note: `#[warn(unused_variables)]` on by default
.access_context
.get_access_by_uid_and_model_id(uid, model.id)
.await
{
Ok(access) => {
let mut is_editor = false;
let access = match access {
Expand All @@ -187,23 +191,23 @@ impl EcdarApi for ConcreteEcdarApi {
is_editor = false;
}

Check failure on line 192 in src/api/ecdar_api.rs

View workflow job for this annotation

GitHub Actions / Clippy lint and check

this if-then-else expression assigns a bool literal

error: this if-then-else expression assigns a bool literal --> src/api/ecdar_api.rs:188:25 | 188 | / if access.role == "Editor" { 189 | | is_editor = true; 190 | | } else { 191 | | is_editor = false; 192 | | } | |_________________________^ help: you can reduce it to: `is_editor = access.role == "Editor";` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool_assign = note: `-D clippy::needless-bool-assign` implied by `-D clippy::complexity` = help: to override `-D clippy::complexity` add `#[allow(clippy::needless_bool_assign)]`

Check failure on line 192 in src/api/ecdar_api.rs

View workflow job for this annotation

GitHub Actions / Clippy lint and check

this if-then-else expression assigns a bool literal

error: this if-then-else expression assigns a bool literal --> src/api/ecdar_api.rs:188:25 | 188 | / if access.role == "Editor" { 189 | | is_editor = true; 190 | | } else { 191 | | is_editor = false; 192 | | } | |_________________________^ help: you can reduce it to: `is_editor = access.role == "Editor";` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool_assign = note: `-D clippy::needless-bool-assign` implied by `-D clippy::complexity` = help: to override `-D clippy::complexity` add `#[allow(clippy::needless_bool_assign)]`
Some(access)
},
None => {
None
},
}
None => None,
};

if !is_editor || access.is_none() {
return Err(Status::permission_denied("You do not have permission to update this model"))
return Err(Status::permission_denied(
"You do not have permission to update this model",
));
}

access.unwrap()
},
}
Err(error) => return Err(Status::internal(error.to_string())),
};

let new_model = model::Model {
id: model.id,
let new_model = model::Model {
id: model.id,
name: match message.clone().name {
Some(name) => name,
None => model.name,
Expand Down

0 comments on commit 62dc3c4

Please sign in to comment.