Skip to content

Commit 317de11

Browse files
committed
run cargo fmt
1 parent 4b95d9a commit 317de11

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

src/helpers/github.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ use std::{
66
use reqwest::{header::LINK, Method, StatusCode, Url};
77
use tokio_stream::Stream;
88

9-
use crate::{entities::{Credentials, MetadataSource}, errors::{self, ResponseError}, FilterValue};
9+
use crate::{
10+
entities::{Credentials, MetadataSource},
11+
errors::{self, ResponseError},
12+
FilterValue,
13+
};
1014

1115
#[derive(Clone)]
1216
pub struct GitHubClient {
@@ -713,8 +717,10 @@ impl GitHubRepoSourceKind {
713717
GitHubRepoSourceKind::CurrentUser => match artifact_kind {
714718
GitHubArtifactKind::Gist => artifact_kind.api_endpoint().to_string(),
715719
_ => format!("user/{}", artifact_kind.api_endpoint()),
720+
},
721+
GitHubRepoSourceKind::User(u) => {
722+
format!("users/{}/{}", u, artifact_kind.api_endpoint())
716723
}
717-
GitHubRepoSourceKind::User(u) => format!("users/{}/{}", u, artifact_kind.api_endpoint()),
718724
GitHubRepoSourceKind::Org(o) => format!("orgs/{}/{}", o, artifact_kind.api_endpoint()),
719725
GitHubRepoSourceKind::Repo(r) => format!("repos/{}", r),
720726
GitHubRepoSourceKind::Gist(g) => format!("gists/{}", g),
@@ -733,18 +739,18 @@ impl std::str::FromStr for GitHubRepoSourceKind {
733739
match kind {
734740
"users" if !identifier.contains('/') => {
735741
return Ok(GitHubRepoSourceKind::User(identifier.to_string()));
736-
},
742+
}
737743
"orgs" if !identifier.contains('/') => {
738744
return Ok(GitHubRepoSourceKind::Org(identifier.to_string()));
739-
},
745+
}
740746
"repos" if identifier.matches('/').count() == 1 => {
741747
return Ok(GitHubRepoSourceKind::Repo(identifier.to_string()));
742-
},
748+
}
743749
"gists" => {
744750
if identifier.eq("starred") {
745-
return Ok(GitHubRepoSourceKind::GistStar())
751+
return Ok(GitHubRepoSourceKind::GistStar());
746752
} else {
747-
return Ok(GitHubRepoSourceKind::Gist(identifier.to_string()))
753+
return Ok(GitHubRepoSourceKind::Gist(identifier.to_string()));
748754
}
749755
}
750756
_ => {}
@@ -842,7 +848,10 @@ mod tests {
842848
gist.inject_metadata(&mut metadata);
843849

844850
assert_eq!(metadata.get("gist.public"), gist.public.into());
845-
assert_eq!(metadata.get("gist.comments_enabled"), gist.comments_enabled.into());
851+
assert_eq!(
852+
metadata.get("gist.comments_enabled"),
853+
gist.comments_enabled.into()
854+
);
846855
assert_eq!(metadata.get("gist.comments"), gist.comments.into());
847856
}
848857
}

src/sources/github_gist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::sync::atomic::AtomicBool;
22

33
use tokio_stream::Stream;
44

5+
use crate::helpers::github::GitHubGist;
56
use crate::{
67
entities::GitRepo,
78
errors::{self},
@@ -12,7 +13,6 @@ use crate::{
1213
policy::BackupPolicy,
1314
BackupSource,
1415
};
15-
use crate::helpers::github::GitHubGist;
1616

1717
#[derive(Clone)]
1818
pub struct GitHubGistSource {

0 commit comments

Comments
 (0)