File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ fn create_mod(download_link: &str, config: &mut Config) {
225225 download_link : download_link. to_string ( ) ,
226226 } ;
227227
228- let url = get_index_url ( "/v1/mods" . to_string ( ) , config) ;
228+ let url = get_index_url ( "/v1/mods" , config) ;
229229
230230 info ! ( "Creating mod" ) ;
231231
@@ -308,11 +308,11 @@ fn set_index_url(url: String, config: &mut Config) {
308308 info ! ( "Index URL set to: {}" , config. index_url) ;
309309}
310310
311- pub fn get_index_url ( path : String , config : & Config ) -> String {
311+ pub fn get_index_url ( path : impl AsRef < str > , config : & Config ) -> String {
312312 format ! (
313313 "{}/{}" ,
314314 config. index_url. trim_end_matches( '/' ) ,
315- path. trim_start_matches( '/' )
315+ path. as_ref ( ) . trim_start_matches( '/' )
316316 )
317317}
318318
Original file line number Diff line number Diff line change @@ -300,7 +300,7 @@ fn list_pending_mods(config: &Config) {
300300fn get_developer_profile ( username : & str , config : & Config ) -> Option < DeveloperProfile > {
301301 let client = reqwest:: blocking:: Client :: new ( ) ;
302302
303- let url = index:: get_index_url ( "/v1/developers" . to_string ( ) , config) ;
303+ let url = index:: get_index_url ( "/v1/developers" , config) ;
304304
305305 let response = client
306306 . get ( url)
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ pub fn login(config: &mut Config, token: Option<String>) {
5555 let client = reqwest:: blocking:: Client :: new ( ) ;
5656
5757 let response: reqwest:: blocking:: Response = client
58- . post ( index:: get_index_url ( "/v1/login/github" . to_string ( ) , config) )
58+ . post ( index:: get_index_url ( "/v1/login/github" , config) )
5959 . header ( USER_AGENT , "GeodeCli" )
6060 . json ( & { } )
6161 . send ( )
@@ -104,7 +104,7 @@ fn poll_login(
104104
105105 let response = client
106106 . post ( index:: get_index_url (
107- "/v1/login/github/poll" . to_string ( ) ,
107+ "/v1/login/github/poll" ,
108108 config,
109109 ) )
110110 . json ( & body)
@@ -164,7 +164,7 @@ fn invalidate_index_tokens(config: &mut Config) {
164164 let client = reqwest:: blocking:: Client :: new ( ) ;
165165
166166 let response = client
167- . delete ( index:: get_index_url ( "/v1/me/tokens" . to_string ( ) , config) )
167+ . delete ( index:: get_index_url ( "/v1/me/tokens" , config) )
168168 . header ( USER_AGENT , "GeodeCLI" )
169169 . bearer_auth ( token)
170170 . send ( )
Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ pub fn get_user_profile(config: &mut Config) -> DeveloperProfile {
291291
292292 let client = reqwest:: blocking:: Client :: new ( ) ;
293293
294- let url = index:: get_index_url ( "/v1/me" . to_string ( ) , config) ;
294+ let url = index:: get_index_url ( "/v1/me" , config) ;
295295
296296 let response = client
297297 . get ( url)
@@ -345,7 +345,7 @@ pub fn edit_profile(config: &mut Config) {
345345 match index {
346346 1 => {
347347 let new_display_name = ask_value ( "New display name" , None , true ) ;
348- let url = index:: get_index_url ( "/v1/me" . to_string ( ) , config) ;
348+ let url = index:: get_index_url ( "/v1/me" , config) ;
349349 let response = client
350350 . put ( url)
351351 . header ( USER_AGENT , "GeodeCLI" )
You can’t perform that action at this time.
0 commit comments