10
10
) ]
11
11
use std:: path:: { Path , PathBuf } ;
12
12
use std:: process:: { self , Output } ;
13
+ use std:: sync:: LazyLock ;
13
14
use std:: { env, io} ;
14
15
15
16
use anyhow:: { Result , anyhow} ;
@@ -88,13 +89,14 @@ pub fn get_git_root() -> anyhow::Result<PathBuf> {
88
89
get_git_output ( & root, & args) . map ( Into :: into)
89
90
}
90
91
91
- pub static GIT_ROOT : Lazy < PathBuf > = Lazy :: new ( || match get_git_root ( ) {
92
- Ok ( root) => root,
93
- Err ( err) => {
94
- fail ! ( "Failed to determine Git root directory.\n {err}" ) ;
95
- process:: exit ( 1 )
96
- } ,
97
- } ) ;
92
+ pub static GIT_ROOT : std:: sync:: LazyLock < PathBuf > =
93
+ std:: sync:: LazyLock :: new ( || match get_git_root ( ) {
94
+ Ok ( root) => root,
95
+ Err ( err) => {
96
+ fail ! ( "Failed to determine Git root directory.\n {err}" ) ;
97
+ process:: exit ( 1 )
98
+ } ,
99
+ } ) ;
98
100
99
101
type Git = Lazy < Box < dyn Fn ( & [ & str ] ) -> Result < String > + Send + Sync > > ;
100
102
@@ -105,7 +107,7 @@ pub static GIT: Git = Lazy::new(|| {
105
107
} )
106
108
} ) ;
107
109
108
- pub static CLIENT : Lazy < Client > = Lazy :: new ( || * Box :: new ( reqwest:: Client :: new ( ) ) ) ;
110
+ pub static CLIENT : LazyLock < Client > = LazyLock :: new ( || * Box :: new ( reqwest:: Client :: new ( ) ) ) ;
109
111
110
112
/// Fetches a branch of a remote into local. Optionally accepts a commit hash
111
113
/// for versioning.
@@ -167,7 +169,7 @@ pub fn add_remote_branch(
167
169
} ) ?;
168
170
169
171
log:: trace!( "...and did a hard reset to commit {}" , commit_hash. as_ref( ) ) ;
170
- } ;
172
+ }
171
173
172
174
Ok ( ( ) )
173
175
}
@@ -195,7 +197,7 @@ pub fn checkout_from_remote(branch: &str, remote: &str) -> anyhow::Result<String
195
197
return Err ( anyhow ! (
196
198
"Could not checkout branch: {branch}, which belongs to remote {remote}\n {err}"
197
199
) ) ;
198
- } ;
200
+ }
199
201
200
202
Ok ( current_branch)
201
203
}
@@ -210,7 +212,7 @@ pub fn merge_into_main(
210
212
// nukes the worktree
211
213
GIT ( & [ "reset" , "--hard" ] ) ?;
212
214
return Err ( anyhow ! ( "Could not merge {remote_branch}\n {err}" ) ) ;
213
- } ;
215
+ }
214
216
215
217
// --squash will NOT commit anything. So we need to make it manually
216
218
GIT ( & [
0 commit comments