From da0ccab39cddf017affcf4ffe3de5b34e8149f95 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Wed, 1 Nov 2023 08:31:36 +0100 Subject: [PATCH] Fix a bunch of clippy issues (#482) --- examples/github_app_authentication.rs | 1 - src/api/projects/projects.rs | 24 +++++++++++----------- tests/projects_repo_list_projects_test.rs | 2 +- tests/projects_user_create_project_test.rs | 8 ++------ 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/examples/github_app_authentication.rs b/examples/github_app_authentication.rs index 0720a0a9..c5200ab4 100644 --- a/examples/github_app_authentication.rs +++ b/examples/github_app_authentication.rs @@ -1,4 +1,3 @@ -use octocrab::models::InstallationRepositories; use octocrab::Octocrab; #[tokio::main] diff --git a/src/api/projects/projects.rs b/src/api/projects/projects.rs index 0eeb3319..eb89e130 100644 --- a/src/api/projects/projects.rs +++ b/src/api/projects/projects.rs @@ -149,8 +149,8 @@ pub struct ListUserProjectsBuilder<'octo, 'r> { impl<'octo, 'r> ListUserProjectsBuilder<'octo, 'r> { pub fn new(handler: &'r ProjectHandler<'octo>, username: String) -> Self { Self { - handler: handler, - username: username, + handler, + username, per_page: None, page: None, } @@ -198,7 +198,7 @@ impl<'octo, 'r> ListOrgProjectsBuilder<'octo, 'r> { per_page: None, page: None, state: None, - org: org, + org, } } @@ -247,8 +247,8 @@ impl<'octo, 'r> CreateOrgProjectsBuilder<'octo, 'r> { Self { handler, body: None, - name: name, - org: org, + name, + org, } } @@ -285,8 +285,8 @@ impl<'octo, 'r> ListRepositoryProjectsBuilder<'octo, 'r> { handler, per_page: None, page: None, - owner: owner, - repo: repo, + owner, + repo, } } @@ -342,10 +342,10 @@ impl<'octo, 'r> CreateRepositoryProjectsBuilder<'octo, 'r, NotNamed> { per_page: None, page: None, body: None, - owner: owner, - repo: repo, + owner, + repo, project_name: None, - _named: PhantomData::default(), + _named: PhantomData, } } @@ -361,7 +361,7 @@ impl<'octo, 'r> CreateRepositoryProjectsBuilder<'octo, 'r, NotNamed> { owner: self.owner, repo: self.repo, project_name: Some(name.into()), - _named: PhantomData::default(), + _named: PhantomData, } } } @@ -376,7 +376,7 @@ impl<'octo, 'r> CreateRepositoryProjectsBuilder<'octo, 'r, Named> { owner: repo_builder.owner, repo: repo_builder.repo, project_name: repo_builder.project_name, - _named: PhantomData::default(), + _named: PhantomData, } } diff --git a/tests/projects_repo_list_projects_test.rs b/tests/projects_repo_list_projects_test.rs index 7bf45fe1..c1663836 100644 --- a/tests/projects_repo_list_projects_test.rs +++ b/tests/projects_repo_list_projects_test.rs @@ -44,7 +44,7 @@ async fn should_list_repo_projects() { serde_json::from_str(include_str!("resources/projects.json")).unwrap(); let test_login = repo_project[0].creator.login.clone(); - let test_id = repo_project[1].id.clone(); + let test_id = repo_project[1].id; let page_response = FakePage { items: repo_project, diff --git a/tests/projects_user_create_project_test.rs b/tests/projects_user_create_project_test.rs index 75b963a0..2160f2d3 100644 --- a/tests/projects_user_create_project_test.rs +++ b/tests/projects_user_create_project_test.rs @@ -18,15 +18,11 @@ async fn setup_api(template: ResponseTemplate) -> MockServer { let mock_server = MockServer::start().await; Mock::given(method("POST")) - .and(path(format!("/user/projects"))) + .and(path("/user/projects")) .respond_with(template) .mount(&mock_server) .await; - setup_error_handler( - &mock_server, - &format!("POST on /users/projects was not received"), - ) - .await; + setup_error_handler(&mock_server, "POST on /users/projects was not received").await; mock_server }