Skip to content

Commit

Permalink
fix: clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Aug 21, 2023
1 parent 35a5430 commit a8aad7a
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl Configuration {
warn!("No config file found. Creating default config file ...");

let config = Configuration::default();
let _ = config.save_to_file(config_path).await;
let () = config.save_to_file(config_path).await;

return Err(ConfigError::Message(format!(
"No config file found. Created default config file in {config_path}. Edit the file and start the application."
Expand Down
2 changes: 1 addition & 1 deletion src/databases/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ impl Database for Mysql {
let announce_urls = announce_urls.iter().flatten().collect::<Vec<&String>>();

for tracker_url in &announce_urls {
let _ = query("INSERT INTO torrust_torrent_announce_urls (torrent_id, tracker_url) VALUES (?, ?)")
let () = query("INSERT INTO torrust_torrent_announce_urls (torrent_id, tracker_url) VALUES (?, ?)")
.bind(torrent_id)
.bind(tracker_url)
.execute(&mut tx)
Expand Down
2 changes: 1 addition & 1 deletion src/databases/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ impl Database for Sqlite {
let announce_urls = announce_urls.iter().flatten().collect::<Vec<&String>>();

for tracker_url in &announce_urls {
let _ = query("INSERT INTO torrust_torrent_announce_urls (torrent_id, tracker_url) VALUES (?, ?)")
let () = query("INSERT INTO torrust_torrent_announce_urls (torrent_id, tracker_url) VALUES (?, ?)")
.bind(torrent_id)
.bind(tracker_url)
.execute(&mut tx)
Expand Down
2 changes: 1 addition & 1 deletion src/services/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Service {
}

match self.category_repository.delete(category_name).await {
Ok(_) => Ok(()),
Ok(()) => Ok(()),
Err(e) => match e {
DatabaseError::CategoryNotFound => Err(ServiceError::CategoryNotFound),
_ => Err(ServiceError::DatabaseError),
Expand Down
4 changes: 2 additions & 2 deletions src/services/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Service {
}

match self.tag_repository.add(tag_name).await {
Ok(_) => Ok(()),
Ok(()) => Ok(()),
Err(e) => match e {
DatabaseError::TagAlreadyExists => Err(ServiceError::TagAlreadyExists),
_ => Err(ServiceError::DatabaseError),
Expand All @@ -65,7 +65,7 @@ impl Service {
}

match self.tag_repository.delete(tag_id).await {
Ok(_) => Ok(()),
Ok(()) => Ok(()),
Err(e) => match e {
DatabaseError::TagNotFound => Err(ServiceError::TagNotFound),
_ => Err(ServiceError::DatabaseError),
Expand Down
2 changes: 1 addition & 1 deletion src/web/api/v1/contexts/category/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub async fn delete_handler(
};

match app_data.category_service.delete_category(&category_form.name, &user_id).await {
Ok(_) => deleted_category(&category_form.name).into_response(),
Ok(()) => deleted_category(&category_form.name).into_response(),
Err(error) => error.into_response(),
}
}
4 changes: 2 additions & 2 deletions src/web/api/v1/contexts/tag/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub async fn add_handler(
};

match app_data.tag_service.add_tag(&add_tag_form.name, &user_id).await {
Ok(_) => added_tag(&add_tag_form.name).into_response(),
Ok(()) => added_tag(&add_tag_form.name).into_response(),
Err(error) => error.into_response(),
}
}
Expand All @@ -77,7 +77,7 @@ pub async fn delete_handler(
};

match app_data.tag_service.delete_tag(&delete_tag_form.tag_id, &user_id).await {
Ok(_) => deleted_tag(delete_tag_form.tag_id).into_response(),
Ok(()) => deleted_tag(delete_tag_form.tag_id).into_response(),
Err(error) => error.into_response(),
}
}
2 changes: 1 addition & 1 deletion src/web/api/v1/contexts/user/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub async fn ban_handler(
};

match app_data.ban_service.ban_user(&to_be_banned_username.0, &user_id).await {
Ok(_) => Json(OkResponseData {
Ok(()) => Json(OkResponseData {
data: format!("Banned user: {}", to_be_banned_username.0),
})
.into_response(),
Expand Down

0 comments on commit a8aad7a

Please sign in to comment.