Skip to content

Commit d8f637e

Browse files
committed
[𝘀𝗽𝗿] changes to master this commit is based on
Created using spr 1.3.6-beta.1 [skip ci]
1 parent 9af64bb commit d8f637e

File tree

4 files changed

+26
-31
lines changed

4 files changed

+26
-31
lines changed

spr/src/commands/list.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,18 @@ type URI = String;
1919
)]
2020
pub struct SearchQuery;
2121

22-
pub async fn list(
23-
config: &crate::config::Config,
24-
) -> Result<()> {
22+
pub async fn list(config: &crate::config::Config) -> Result<()> {
2523
let variables = search_query::Variables {
2624
query: format!(
2725
"repo:{}/{} is:open is:pr author:@me archived:false",
2826
config.owner, config.repo
2927
),
3028
};
3129
let request_body = SearchQuery::build_query(variables);
32-
let response_body: Response<search_query::ResponseData> = octocrab::instance()
33-
.post("/graphql",Some(&request_body))
34-
.await?;
30+
let response_body: Response<search_query::ResponseData> =
31+
octocrab::instance()
32+
.post("/graphql", Some(&request_body))
33+
.await?;
3534

3635
print_pr_info(response_body).ok_or_else(|| Error::new("unexpected error"))
3736
}

spr/src/git.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ pub struct Git {
3636
impl Git {
3737
pub fn new(repo: git2::Repository) -> Self {
3838
Self {
39-
hooks: std::sync::Arc::new(std::sync::Mutex::new(git2_ext::hooks::Hooks::with_repo(&repo).unwrap())),
39+
hooks: std::sync::Arc::new(std::sync::Mutex::new(
40+
git2_ext::hooks::Hooks::with_repo(&repo).unwrap(),
41+
)),
4042
repo: std::sync::Arc::new(std::sync::Mutex::new(repo)),
4143
}
4244
}

spr/src/github.rs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,8 @@ type GitObjectID = String;
130130
pub struct PullRequestMergeabilityQuery;
131131

132132
impl GitHub {
133-
pub fn new(
134-
config: crate::config::Config,
135-
git: crate::git::Git,
136-
) -> Self {
137-
Self {
138-
config,
139-
git,
140-
}
133+
pub fn new(config: crate::config::Config, git: crate::git::Git) -> Self {
134+
Self { config, git }
141135
}
142136

143137
pub async fn get_github_user(login: String) -> Result<UserWithName> {
@@ -159,20 +153,18 @@ impl GitHub {
159153
}
160154

161155
pub async fn get_pull_request(self, number: u64) -> Result<PullRequest> {
162-
let GitHub {
163-
config,
164-
git,
165-
} = self;
156+
let GitHub { config, git } = self;
166157

167158
let variables = pull_request_query::Variables {
168159
name: config.repo.clone(),
169160
owner: config.owner.clone(),
170161
number: number as i64,
171162
};
172163
let request_body = PullRequestQuery::build_query(variables);
173-
let response_body: Response<pull_request_query::ResponseData> = octocrab::instance()
174-
.post("/graphql", Some(&request_body))
175-
.await?;
164+
let response_body: Response<pull_request_query::ResponseData> =
165+
octocrab::instance()
166+
.post("/graphql", Some(&request_body))
167+
.await?;
176168

177169
if let Some(errors) = response_body.errors {
178170
let error =
@@ -387,10 +379,11 @@ impl GitHub {
387379
number: number as i64,
388380
};
389381
let request_body = PullRequestMergeabilityQuery::build_query(variables);
390-
let response_body: Response<pull_request_mergeability_query::ResponseData> =
391-
octocrab::instance()
392-
.post("/graphql", Some(&request_body))
393-
.await?;
382+
let response_body: Response<
383+
pull_request_mergeability_query::ResponseData,
384+
> = octocrab::instance()
385+
.post("/graphql", Some(&request_body))
386+
.await?;
394387

395388
if let Some(errors) = response_body.errors {
396389
let error = Err(Error::new(format!(

spr/src/main.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@ pub async fn spr() -> Result<()> {
157157
None => git_config.get_string("spr.githubAuthToken"),
158158
}?;
159159

160-
octocrab::initialise(octocrab::Octocrab::builder().personal_token(github_auth_token.clone()).build()?);
160+
octocrab::initialise(
161+
octocrab::Octocrab::builder()
162+
.personal_token(github_auth_token.clone())
163+
.build()?,
164+
);
161165

162166
let mut headers = header::HeaderMap::new();
163167
headers.insert(header::ACCEPT, "application/json".parse()?);
@@ -170,10 +174,7 @@ pub async fn spr() -> Result<()> {
170174
format!("Bearer {}", github_auth_token).parse()?,
171175
);
172176

173-
let mut gh = spr::github::GitHub::new(
174-
config.clone(),
175-
git.clone(),
176-
);
177+
let mut gh = spr::github::GitHub::new(config.clone(), git.clone());
177178

178179
match cli.command {
179180
Commands::Diff(opts) => {

0 commit comments

Comments
 (0)