@@ -15,7 +15,7 @@ use crate::util::get_hostname;
1515
1616impl interface:: HomeArgs {
1717 pub fn run ( self ) -> Result < ( ) > {
18- use HomeRebuildVariant :: * ;
18+ use HomeRebuildVariant :: { Build , Switch } ;
1919 match self . subcommand {
2020 HomeSubcommand :: Switch ( args) => args. rebuild ( Switch ) ,
2121 HomeSubcommand :: Build ( args) => {
@@ -37,7 +37,7 @@ enum HomeRebuildVariant {
3737
3838impl HomeRebuildArgs {
3939 fn rebuild ( self , variant : HomeRebuildVariant ) -> Result < ( ) > {
40- use HomeRebuildVariant :: * ;
40+ use HomeRebuildVariant :: Build ;
4141
4242 if self . update_args . update {
4343 update ( & self . common . installable , self . update_args . update_input ) ?;
@@ -170,10 +170,10 @@ where
170170 I : IntoIterator < Item = S > ,
171171 S : AsRef < std:: ffi:: OsStr > ,
172172{
173- let mut res = installable. clone ( ) ;
173+ let mut res = installable;
174174 let extra_args: Vec < OsString > = {
175175 let mut vec = Vec :: new ( ) ;
176- for elem in extra_args. into_iter ( ) {
176+ for elem in extra_args {
177177 vec. push ( elem. as_ref ( ) . to_owned ( ) ) ;
178178 }
179179 vec
@@ -206,7 +206,7 @@ where
206206 // Check if an explicit configuration name was provided via the flag
207207 if let Some ( config_name) = configuration_name {
208208 // Verify the provided configuration exists
209- let func = format ! ( r#" x: x ? "{}" "# , config_name ) ;
209+ let func = format ! ( r#" x: x ? "{config_name }" "# ) ;
210210 let check_res = commands:: Command :: new ( "nix" )
211211 . arg ( "eval" )
212212 . args ( & extra_args)
@@ -228,29 +228,26 @@ where
228228 )
229229 } ) ?;
230230
231- match check_res. map ( |s| s. trim ( ) . to_owned ( ) ) . as_deref ( ) {
232- Some ( "true" ) => {
233- debug ! ( "Using explicit configuration from flag: {}" , config_name) ;
234- attribute. push ( config_name. clone ( ) ) ;
235- if push_drv {
236- attribute. extend ( toplevel. clone ( ) ) ;
237- }
238- found_config = true ;
239- }
240- _ => {
241- // Explicit config provided but not found
242- let tried_attr_path = {
243- let mut attr_path = attribute. clone ( ) ;
244- attr_path. push ( config_name. clone ( ) ) ;
245- Installable :: Flake {
246- reference : flake_reference. clone ( ) ,
247- attribute : attr_path,
248- }
249- . to_args ( )
250- . join ( " " )
251- } ;
252- bail ! ( "Explicitly specified home-manager configuration not found: {tried_attr_path}" ) ;
231+ if check_res. map ( |s| s. trim ( ) . to_owned ( ) ) . as_deref ( ) == Some ( "true" ) {
232+ debug ! ( "Using explicit configuration from flag: {}" , config_name) ;
233+ attribute. push ( config_name) ;
234+ if push_drv {
235+ attribute. extend ( toplevel. clone ( ) ) ;
253236 }
237+ found_config = true ;
238+ } else {
239+ // Explicit config provided but not found
240+ let tried_attr_path = {
241+ let mut attr_path = attribute. clone ( ) ;
242+ attr_path. push ( config_name) ;
243+ Installable :: Flake {
244+ reference : flake_reference,
245+ attribute : attr_path,
246+ }
247+ . to_args ( )
248+ . join ( " " )
249+ } ;
250+ bail ! ( "Explicitly specified home-manager configuration not found: {tried_attr_path}" ) ;
254251 }
255252 }
256253
@@ -260,8 +257,8 @@ where
260257 let hostname = get_hostname ( ) ?;
261258 let mut tried = vec ! [ ] ;
262259
263- for attr_name in [ format ! ( "{username}@{hostname}" ) , username. to_string ( ) ] {
264- let func = format ! ( r#" x: x ? "{}" "# , attr_name ) ;
260+ for attr_name in [ format ! ( "{username}@{hostname}" ) , username] {
261+ let func = format ! ( r#" x: x ? "{attr_name }" "# ) ;
265262 let check_res = commands:: Command :: new ( "nix" )
266263 . arg ( "eval" )
267264 . args ( & extra_args)
@@ -293,7 +290,7 @@ where
293290 match check_res. map ( |s| s. trim ( ) . to_owned ( ) ) . as_deref ( ) {
294291 Some ( "true" ) => {
295292 debug ! ( "Using automatically detected configuration: {}" , attr_name) ;
296- attribute. push ( attr_name. clone ( ) ) ;
293+ attribute. push ( attr_name) ;
297294 if push_drv {
298295 attribute. extend ( toplevel. clone ( ) ) ;
299296 }
0 commit comments