Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xou816 committed Nov 26, 2024
1 parent d6d0e4b commit 56f80dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
8 changes: 3 additions & 5 deletions src/app/components/login/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use url::Url;

use crate::app::components::EventListener;
use crate::app::state::{LoginEvent, LoginStartedEvent};
use crate::app::{AppEvent, Worker};
use crate::app::AppEvent;

use super::LoginModel;
mod imp {
Expand Down Expand Up @@ -93,11 +93,10 @@ pub struct Login {
parent: gtk::Window,
login_window: LoginWindow,
model: Rc<LoginModel>,
worker: Worker,
}

impl Login {
pub fn new(parent: gtk::Window, model: LoginModel, worker: Worker) -> Self {
pub fn new(parent: gtk::Window, model: LoginModel) -> Self {
let model = Rc::new(model);

let login_window = LoginWindow::new();
Expand All @@ -116,7 +115,6 @@ impl Login {
parent,
login_window,
model,
worker,
}
}

Expand All @@ -140,7 +138,7 @@ impl Login {
}

fn open_login_url(&self, url: Url) {
if let Err(_) = open::that(url.as_str()) {
if open::that(url.as_str()).is_err() {
warn!("Could not open login page");
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl App {
dispatcher.box_clone(),
worker.clone(),
),
App::make_login(builder, dispatcher.box_clone(), worker.clone()),
App::make_login(builder, dispatcher.box_clone()),
App::make_navigation(
builder,
Rc::clone(model),
Expand Down Expand Up @@ -179,14 +179,10 @@ impl App {
))
}

fn make_login(
builder: &gtk::Builder,
dispatcher: Box<dyn ActionDispatcher>,
worker: Worker,
) -> Box<Login> {
fn make_login(builder: &gtk::Builder, dispatcher: Box<dyn ActionDispatcher>) -> Box<Login> {
let parent: gtk::Window = builder.object("window").unwrap();
let model = LoginModel::new(dispatcher);
Box::new(Login::new(parent, model, worker))
Box::new(Login::new(parent, model))
}

fn make_selection_toolbar(
Expand Down
9 changes: 3 additions & 6 deletions src/player/oauth2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,14 @@ impl SpotOauthClient {

pub async fn spawn_authcode_listener(
&self,
notify_complete: impl FnOnce() -> () + 'static,
notify_complete: impl FnOnce() + 'static,
) -> Result<AuthcodeChallenge, OAuthError> {
let (pkce_challenge, pkce_verifier) = PkceCodeChallenge::new_random_sha256();

// Generate the full authorization URL.
// Some of these scopes are unavailable for custom client IDs. Which?
let request_scopes: Vec<oauth2::Scope> = SCOPES
.split(",")
.into_iter()
.map(|s| Scope::new(s.into()))
.collect();
let request_scopes: Vec<oauth2::Scope> =
SCOPES.split(",").map(|s| Scope::new(s.into())).collect();

let (auth_url, csrf_token) = self
.client
Expand Down

0 comments on commit 56f80dd

Please sign in to comment.