@@ -9,9 +9,7 @@ use serde::{Deserialize, Serialize};
99use serde_json:: Value ;
1010use std:: path:: PathBuf ;
1111
12- use crate :: models:: {
13- GraphQLResponse , Issue , Notification , PullRequest , Repository , User ,
14- } ;
12+ use crate :: models:: { GraphQLResponse , Issue , Notification , PullRequest , Repository , User } ;
1513
1614const GRAPHQL_ENDPOINT : & str = "https://api.github.com/graphql" ;
1715const REST_ENDPOINT : & str = "https://api.github.com" ;
@@ -77,12 +75,11 @@ impl GitHubClient {
7775 ) ;
7876 }
7977
80- let content = std :: fs :: read_to_string ( & config_path )
81- . context ( "Failed to read gh config file" ) ?;
78+ let content =
79+ std :: fs :: read_to_string ( & config_path ) . context ( "Failed to read gh config file" ) ?;
8280
8381 // Parse YAML config
84- let config: Value = serde_yaml:: from_str ( & content)
85- . context ( "Failed to parse gh config" ) ?;
82+ let config: Value = serde_yaml:: from_str ( & content) . context ( "Failed to parse gh config" ) ?;
8683
8784 // Extract token for github.com
8885 let token = config
@@ -107,8 +104,7 @@ impl GitHubClient {
107104 }
108105
109106 // Fall back to ~/.config/gh/hosts.yml
110- let home = dirs:: home_dir ( )
111- . context ( "Could not determine home directory" ) ?;
107+ let home = dirs:: home_dir ( ) . context ( "Could not determine home directory" ) ?;
112108
113109 Ok ( home. join ( ".config" ) . join ( "gh" ) . join ( "hosts.yml" ) )
114110 }
@@ -141,14 +137,13 @@ impl GitHubClient {
141137
142138 let text = response. text ( ) . await . context ( "Failed to read response" ) ?;
143139
144- let result: GraphQLResponse < T > = serde_json:: from_str ( & text)
145- . map_err ( |e| {
146- anyhow:: anyhow!(
147- "JSON parse error: {} | Raw: {}" ,
148- e,
149- & text[ ..text. len( ) . min( 500 ) ]
150- )
151- } ) ?;
140+ let result: GraphQLResponse < T > = serde_json:: from_str ( & text) . map_err ( |e| {
141+ anyhow:: anyhow!(
142+ "JSON parse error: {} | Raw: {}" ,
143+ e,
144+ & text[ ..text. len( ) . min( 500 ) ]
145+ )
146+ } ) ?;
152147
153148 // Check for GraphQL errors
154149 if result. data . is_none ( ) {
@@ -160,9 +155,7 @@ impl GitHubClient {
160155 }
161156 }
162157
163- result
164- . data
165- . context ( "GraphQL response missing data field" )
158+ result. data . context ( "GraphQL response missing data field" )
166159 }
167160
168161 /// Execute a REST API request (GET).
@@ -305,7 +298,9 @@ impl GitHubClient {
305298
306299 let v = match result {
307300 Ok ( r) => r. viewer ,
308- Err ( e) if e. to_string ( ) . contains ( "user:email" ) || e. to_string ( ) . contains ( "read:user" ) => {
301+ Err ( e)
302+ if e. to_string ( ) . contains ( "user:email" ) || e. to_string ( ) . contains ( "read:user" ) =>
303+ {
309304 // Token lacks email scope, try without
310305 let r: ViewerResponse = self . graphql ( query_without_email, None ) . await ?;
311306 r. viewer
@@ -505,6 +500,7 @@ impl GitHubClient {
505500 }
506501
507502 #[ derive( Deserialize ) ]
503+ #[ allow( dead_code) ]
508504 struct LabelNode {
509505 name : String ,
510506 color : String ,
@@ -568,12 +564,7 @@ impl GitHubClient {
568564 }
569565
570566 /// Get pull request details with status checks and reviews.
571- pub async fn get_pr (
572- & self ,
573- owner : & str ,
574- repo : & str ,
575- pr_number : i32 ,
576- ) -> Result < PullRequest > {
567+ pub async fn get_pr ( & self , owner : & str , repo : & str , pr_number : i32 ) -> Result < PullRequest > {
577568 let query = r#"
578569 query($owner: String!, $name: String!, $number: Int!) {
579570 repository(owner: $owner, name: $name) {
0 commit comments