@@ -12,6 +12,7 @@ use reqwest::Client;
1212use semver:: Version ;
1313use std:: cmp:: min;
1414use std:: env;
15+ use std:: fmt:: Write ;
1516use std:: path:: Path ;
1617use std:: process:: Stdio ;
1718use tokio:: fs:: File ;
@@ -61,6 +62,7 @@ use super::{InstallResult, PostDownloadVersionType};
6162/// let config = Config::default();
6263/// let result = start(&mut version, &client, &config).await;
6364/// ```
65+ #[ allow( clippy:: too_many_lines) ]
6466pub async fn start (
6567 version : & ParsedVersion ,
6668 client : & Client ,
@@ -108,7 +110,7 @@ pub async fn start(
108110
109111 match config. config . enable_nightly_info {
110112 Some ( boolean) if boolean => {
111- print_commits ( client, & local_nightly, upstream_nightly) . await ?
113+ print_commits ( client, & local_nightly, upstream_nightly) . await ?;
112114 }
113115 None => print_commits ( client, & local_nightly, upstream_nightly) . await ?,
114116 _ => ( ) ,
@@ -132,7 +134,7 @@ pub async fn start(
132134
133135 if let PostDownloadVersionType :: Standard ( downloaded_archive) = downloaded_archive {
134136 if version. semver . is_some ( ) && version. semver . as_ref ( ) . unwrap ( ) <= & Version :: new ( 0 , 4 , 4 ) {
135- unarchive:: start ( downloaded_archive) . await ?
137+ unarchive:: start ( & downloaded_archive) . await ?;
136138 } else {
137139 let downloaded_checksum =
138140 download_version ( client, version, root, & config. config , true ) . await ?;
@@ -147,7 +149,7 @@ pub async fn start(
147149 downloaded_checksum. file_name, downloaded_checksum. file_format
148150 ) ) ;
149151
150- let platform = helpers:: get_platform_name ( & version. semver ) ;
152+ let platform = helpers:: get_platform_name ( version. semver . as_ref ( ) ) ;
151153
152154 if !sha256cmp (
153155 & archive_path,
@@ -161,10 +163,10 @@ pub async fn start(
161163
162164 info ! ( "Checksum matched!" ) ;
163165 tokio:: fs:: remove_file ( checksum_path) . await ?;
164- unarchive:: start ( downloaded_archive) . await ?
166+ unarchive:: start ( & downloaded_archive) . await ?;
165167 } else if let PostDownloadVersionType :: None = downloaded_checksum {
166168 warn ! ( "No checksum provided, skipping checksum verification" ) ;
167- unarchive:: start ( downloaded_archive) . await ?
169+ unarchive:: start ( & downloaded_archive) . await ?;
168170 }
169171 }
170172 }
@@ -250,8 +252,7 @@ async fn handle_rollback(config: &Config) -> Result<()> {
250252
251253 info ! ( "Creating rollback: nightly-{id}" ) ;
252254 filesystem:: copy_dir_async ( "nightly" , format ! ( "nightly-{id}" ) ) . await ?;
253-
254- json_struct. tag_name += & format ! ( "-{id}" ) ;
255+ let _ = write ! ( json_struct. tag_name, "-{id}" ) ;
255256
256257 let json_file = serde_json:: to_string ( & json_struct) ?;
257258 fs:: write ( format ! ( "nightly-{id}/bob.json" ) , json_file) . await ?;
@@ -311,7 +312,7 @@ async fn print_commits(
311312/// This function sends a request to download the specified version of Neovim based on the version type.
312313/// If the version type is Normal, Nightly, or Latest, it sends a request to download the version.
313314/// If the version type is Hash, it handles building from the source.
314- /// If the version type is NightlyRollback, it does nothing.
315+ /// If the version type is ` NightlyRollback` , it does nothing.
315316///
316317/// # Arguments
317318///
@@ -389,7 +390,7 @@ async fn download_version(
389390 pbw. finish ( root, file_type. clone ( ) . into ( ) ) ;
390391
391392 Ok ( PostDownloadVersionType :: Standard ( LocalVersion {
392- file_name : version. tag_name . to_owned ( ) ,
393+ file_name : version. tag_name . clone ( ) ,
393394 file_format : file_type. to_string ( ) ,
394395 path : root. display ( ) . to_string ( ) ,
395396 semver : version. semver . clone ( ) ,
@@ -508,6 +509,7 @@ fn file_type_ext(version: &ParsedVersion, get_sha256sum: bool) -> std::borrow::C
508509/// let config = Config::default();
509510/// let result = handle_building_from_source(&version, &config).await;
510511/// ```
512+ #[ allow( clippy:: too_many_lines) ]
511513#[ rustfmt:: skip]
512514async fn handle_building_from_source ( version : & ParsedVersion , config : & Config ) -> Result < PostDownloadVersionType > {
513515 cfg_if:: cfg_if! {
@@ -560,7 +562,7 @@ async fn handle_building_from_source(version: &ParsedVersion, config: &Config) -
560562 std:: io:: ErrorKind :: NotFound => {
561563 fs:: create_dir ( dirname) . await ?;
562564 }
563- _ => return Err ( anyhow ! ( "unknown error: {}" , error ) ) ,
565+ _ => return Err ( anyhow ! ( "unknown error: {error}" ) ) ,
564566 }
565567 }
566568
@@ -575,24 +577,24 @@ async fn handle_building_from_source(version: &ParsedVersion, config: &Config) -
575577 . await ?;
576578 }
577579
578- _ => return Err ( anyhow ! ( "unknown error: {}" , error ) ) ,
580+ _ => return Err ( anyhow ! ( "unknown error: {error}" ) ) ,
579581 }
580- } ;
582+ }
581583
582584 {
583585
584586 // check if repo has a remote
585587 let remote = Command :: new ( "git" ) . arg ( "remote" ) . arg ( "get-url" ) . arg ( "origin" ) . stdout ( Stdio :: null ( ) )
586588 . spawn ( ) ?. wait ( ) . await ?;
587- if ! remote. success ( ) {
588- // add neovim's remote
589- Command :: new ( "git" ) . arg ( "remote" ) . arg ( "add " ) . arg ( "origin" ) . arg ( "https://github.com/neovim/neovim.git" )
589+ if remote. success ( ) {
590+ // set neovim's remote
591+ Command :: new ( "git" ) . arg ( "remote" ) . arg ( "set-url " ) . arg ( "origin" ) . arg ( "https://github.com/neovim/neovim.git" )
590592 . spawn ( ) ?. wait ( ) . await ?;
591593 } else {
592- // set neovim's remote otherwise
593- Command :: new ( "git" ) . arg ( "remote" ) . arg ( "set-url " ) . arg ( "origin" ) . arg ( "https://github.com/neovim/neovim.git" )
594+ // add neovim's remote otherwise
595+ Command :: new ( "git" ) . arg ( "remote" ) . arg ( "add " ) . arg ( "origin" ) . arg ( "https://github.com/neovim/neovim.git" )
594596 . spawn ( ) ?. wait ( ) . await ?;
595- } ;
597+ }
596598 // fetch version from origin
597599 let fetch_successful = Command :: new ( "git" ) . arg ( "fetch" ) . arg ( "--depth" ) . arg ( "1" ) . arg ( "origin" ) . arg ( & version. non_parsed_string )
598600 . spawn ( ) ?. wait ( ) . await ?. success ( ) ;
@@ -672,7 +674,7 @@ where
672674///
673675/// # Behavior
674676///
675- /// The function constructs the download URL based on the provided `version` and `config.github_mirror`. If `config.github_mirror` is `None`, it defaults to " https://github.com" .
677+ /// The function constructs the download URL based on the provided `version` and `config.github_mirror`. If `config.github_mirror` is `None`, it defaults to `< https://github.com>` .
676678///
677679/// It then sends a GET request to the constructed URL with the header "user-agent" set to "bob".
678680///
@@ -702,13 +704,13 @@ async fn send_request(
702704 version : & ParsedVersion ,
703705 get_sha256sum : bool ,
704706) -> Result < reqwest:: Response , reqwest:: Error > {
705- let platform = helpers:: get_platform_name ( & version. semver ) ;
707+ let platform = helpers:: get_platform_name ( version. semver . as_ref ( ) ) ;
706708 let file_type = crate :: FILETYPE_EXT ;
707709
708- let url = config
709- . github_mirror
710- . as_ref ( )
711- . map_or_else ( || "https://github.com" . to_string ( ) , |val| val . to_string ( ) ) ;
710+ let url = config. github_mirror . as_ref ( ) . map_or_else (
711+ || "https://github.com" . to_string ( ) ,
712+ std :: string :: ToString :: to_string ,
713+ ) ;
712714
713715 let version_tag = & version. tag_name ;
714716 let request_url = if get_sha256sum {
0 commit comments