Fix intervals #3675
clippy
31 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 31 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.81.0 (eeb90cda1 2024-09-04)
- cargo 1.81.0 (2dbb1af80 2024-08-20)
- clippy 0.1.81 (eeb90cd 2024-09-04)
Annotations
Check warning on line 737 in src/routes/v3/payouts.rs
github-actions / clippy
deref which would be done by auto-deref
warning: deref which would be done by auto-deref
--> src/routes/v3/payouts.rs:737:52
|
737 | let balance = get_user_balance(user.id.into(), &**pool).await?;
| ^^^^^^^ help: try: `&pool`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
Check warning on line 355 in src/routes/v3/payouts.rs
github-actions / clippy
deref which would be done by auto-deref
warning: deref which would be done by auto-deref
--> src/routes/v3/payouts.rs:355:52
|
355 | let balance = get_user_balance(user.id.into(), &**pool).await?;
| ^^^^^^^ help: try: `&pool`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
Check warning on line 355 in src/routes/v3/payouts.rs
github-actions / clippy
useless conversion to the same type: `database::models::ids::UserId`
warning: useless conversion to the same type: `database::models::ids::UserId`
--> src/routes/v3/payouts.rs:355:36
|
355 | let balance = get_user_balance(user.id.into(), &**pool).await?;
| ^^^^^^^^^^^^^^ help: consider removing `.into()`: `user.id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
Check warning on line 116 in src/routes/v2/version_creation.rs
github-actions / clippy
match can be simplified with `.unwrap_or_default()`
warning: match can be simplified with `.unwrap_or_default()`
--> src/routes/v2/version_creation.rs:109:44
|
109 | Ok(loader_response) => match v2_reroute::extract_ok_json::<
| ____________________________________________^
110 | | Vec<v3::tags::LoaderData>,
111 | | >(loader_response)
112 | | .await
... |
115 | | Err(_) => vec![],
116 | | },
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
= note: `#[warn(clippy::manual_unwrap_or_default)]` on by default
help: replace it with
|
109 ~ Ok(loader_response) => (v2_reroute::extract_ok_json::<
110 + Vec<v3::tags::LoaderData>,
111 + >(loader_response)
112 ~ .await).unwrap_or_default(),
|
Check warning on line 158 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:158:14
|
158 | .map(|x| crate::models::billing::UserSubscription::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::billing::UserSubscription::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 149 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:149:18
|
149 | .map(|x| crate::models::images::Image::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::images::Image::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 113 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:113:14
|
113 | .map(|x| crate::models::reports::Report::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::reports::Report::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 105 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:105:14
|
105 | .map(|x| crate::models::payouts::Payout::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::payouts::Payout::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 84 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:84:14
|
84 | .map(|x| crate::models::oauth_clients::OAuthClientAuthorization::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::oauth_clients::OAuthClientAuthorization::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 76 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:76:14
|
76 | .map(|x| crate::models::oauth_clients::OAuthClient::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::oauth_clients::OAuthClient::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 67 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:67:10
|
67 | .map(|x| crate::models::notifications::Notification::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::notifications::Notification::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 49 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:49:14
|
49 | .map(|x| crate::models::ids::ProjectId::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::ids::ProjectId::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 43 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:43:14
|
43 | .map(|x| crate::models::ids::ProjectId::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::ids::ProjectId::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 37 in src/routes/internal/gdpr.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/routes/internal/gdpr.rs:37:18
|
37 | .map(|x| crate::models::collections::Collection::from(x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `crate::models::collections::Collection::from`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: `#[warn(clippy::redundant_closure)]` on by default
Check warning on line 24 in src/routes/internal/gdpr.rs
github-actions / clippy
deref which would be done by auto-deref
warning: deref which would be done by auto-deref
--> src/routes/internal/gdpr.rs:24:9
|
24 | &*session_queue,
| ^^^^^^^^^^^^^^^ help: try: `&session_queue`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
Check warning on line 1398 in src/routes/internal/flows.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/routes/internal/flows.rs:1396:15
|
1396 | .post(&format!(
| _______________^
1397 | | "https://api.beehiiv.com/v2/publications/{id}/subscriptions"
1398 | | ))
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
help: change this to
|
1396 ~ .post(format!(
1397 + "https://api.beehiiv.com/v2/publications/{id}/subscriptions"
1398 ~ ))
|
Check warning on line 771 in src/routes/internal/flows.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/routes/internal/flows.rs:769:26
|
769 | .get(&format!(
| __________________________^
770 | | "{api_url}identity/openidconnect/userinfo?schema=openid"
771 | | ))
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
help: change this to
|
769 ~ .get(format!(
770 + "{api_url}identity/openidconnect/userinfo?schema=openid"
771 ~ ))
|
Check warning on line 513 in src/routes/internal/flows.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/routes/internal/flows.rs:513:27
|
513 | .post(&format!("{api_url}oauth2/token"))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("{api_url}oauth2/token")`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
Check warning on line 975 in src/routes/internal/billing.rs
github-actions / clippy
useless conversion to the same type: `database::models::ids::UserSubscriptionId`
warning: useless conversion to the same type: `database::models::ids::UserSubscriptionId`
--> src/routes/internal/billing.rs:975:33
|
975 | ... subscription_id.into(),
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `subscription_id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
Check warning on line 765 in src/routes/internal/billing.rs
github-actions / clippy
called `is_some()` after searching an `Iterator` with `find`
warning: called `is_some()` after searching an `Iterator` with `find`
--> src/routes/internal/billing.rs:764:26
|
764 | .find(|x| x.product_id == product.id)
| __________________________^
765 | | .is_some()
| |__________________________________^ help: consider using: `any(|x| x.product_id == product.id)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
= note: `#[warn(clippy::search_is_some)]` on by default
Check warning on line 695 in src/routes/internal/billing.rs
github-actions / clippy
manual implementation of `Option::map`
warning: manual implementation of `Option::map`
--> src/routes/internal/billing.rs:691:17
|
691 | / if let Some(interval) = charge.subscription_interval {
692 | | Some(interval)
693 | | } else {
694 | | None
695 | | },
| |_________________^ help: try: `charge.subscription_interval.map(|interval| interval)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
= note: `#[warn(clippy::manual_map)]` on by default
Check warning on line 190 in src/routes/internal/billing.rs
github-actions / clippy
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/routes/internal/billing.rs:178:13
|
178 | / match ¤t_price.prices {
179 | | Price::Recurring { intervals } => {
180 | | if let Some(price) = intervals.get(interval) {
181 | | open_charge.subscription_interval = Some(*interval);
... |
189 | | _ => {}
190 | | };
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try
|
178 ~ if let Price::Recurring { intervals } = ¤t_price.prices {
179 + if let Some(price) = intervals.get(interval) {
180 + open_charge.subscription_interval = Some(*interval);
181 + open_charge.amount = *price as i64;
182 + } else {
183 + return Err(ApiError::InvalidInput(
184 + "Interval is not valid for this subscription!".to_string(),
185 + ));
186 + }
187 ~ };
|
Check warning on line 77 in src/queue/payouts.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/queue/payouts.rs:77:19
|
77 | .post(&format!("{}oauth2/token", dotenvy::var("PAYPAL_API_URL")?))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("{}oauth2/token", dotenvy::var("PAYPAL_API_URL")?)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
Check warning on line 21 in src/file_hosting/backblaze/delete.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/file_hosting/backblaze/delete.rs:18:15
|
18 | .post(&format!(
| _______________^
19 | | "{}/b2api/v2/b2_delete_file_version",
20 | | authorization_data.api_url
21 | | ))
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
help: change this to
|
18 ~ .post(format!(
19 + "{}/b2api/v2/b2_delete_file_version",
20 + authorization_data.api_url
21 ~ ))
|
Check warning on line 54 in src/database/models/charge_item.rs
github-actions / clippy
deref which would be done by auto-deref
warning: deref which would be done by auto-deref
--> src/database/models/charge_item.rs:54:53
|
54 | .map(|x| PriceDuration::from_string(&*x)),
| ^^^ help: try: `&x`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
= note: `#[warn(clippy::explicit_auto_deref)]` on by default