@@ -6,7 +6,11 @@ use std::{
66use reqwest:: { header:: LINK , Method , StatusCode , Url } ;
77use 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 ) ]
1216pub 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 }
0 commit comments