From e8227d2996e265412597610d9739d8c24cca5084 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Wed, 10 May 2023 17:28:11 +0100 Subject: [PATCH] cargo fmt --- src/api/current.rs | 12 ++++++++---- tests/current_user_orgs_test.rs | 15 ++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/api/current.rs b/src/api/current.rs index 70eed44c..5c4ae338 100644 --- a/src/api/current.rs +++ b/src/api/current.rs @@ -1,7 +1,7 @@ //! Get data about the currently authenticated user. use crate::{ - models::{self, gists::Gist, Repository, orgs::{MembershipInvitation}}, + models::{self, gists::Gist, orgs::MembershipInvitation, Repository}, Octocrab, Page, Result, }; use chrono::{DateTime, Utc}; @@ -138,7 +138,9 @@ impl<'octo> CurrentAuthHandler<'octo> { /// ``` /// /// [See the GitHub API documentation](https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user) - pub fn list_org_memberships_for_authenticated_user(&self) -> ListOrgMembershipsForAuthenticatedUserBuilder<'octo> { + pub fn list_org_memberships_for_authenticated_user( + &self, + ) -> ListOrgMembershipsForAuthenticatedUserBuilder<'octo> { ListOrgMembershipsForAuthenticatedUserBuilder::new(self.crab) } } @@ -512,6 +514,8 @@ impl<'octo> ListOrgMembershipsForAuthenticatedUserBuilder<'octo> { /// Sends the actual request. pub async fn send(self) -> crate::Result> { - self.crab.get("/user/memberships/orgs", (&self).into()).await + self.crab + .get("/user/memberships/orgs", (&self).into()) + .await } -} \ No newline at end of file +} diff --git a/tests/current_user_orgs_test.rs b/tests/current_user_orgs_test.rs index 4e86ba07..5583c801 100644 --- a/tests/current_user_orgs_test.rs +++ b/tests/current_user_orgs_test.rs @@ -1,10 +1,13 @@ // Tests for calls to the /user/memberships/orgs API. mod mock_error; -use octocrab::{models::orgs::MembershipInvitation, Octocrab, Page}; -use serde::{Serialize, Deserialize}; -use wiremock::{ResponseTemplate, MockServer, Mock, matchers::{method, path}}; use mock_error::setup_error_handler; +use octocrab::{models::orgs::MembershipInvitation, Octocrab, Page}; +use serde::{Deserialize, Serialize}; +use wiremock::{ + matchers::{method, path}, + Mock, MockServer, ResponseTemplate, +}; #[derive(Serialize, Deserialize)] struct FakePage { @@ -41,7 +44,9 @@ async fn should_return_page_with_invitations() { let template = ResponseTemplate::new(200).set_body_json(&page_response); let mock_server = setup_api(template).await; let client = setup_octocrab(&mock_server.uri()); - let orgs = client.current().list_org_memberships_for_authenticated_user(); + let orgs = client + .current() + .list_org_memberships_for_authenticated_user(); let result = orgs.send().await; assert!( @@ -58,4 +63,4 @@ async fn should_return_page_with_invitations() { assert_eq!(items[0].organization.login, "elementary"); assert_eq!(items[1].organization.login, "EpicGames"); } -} \ No newline at end of file +}