@@ -86,24 +86,26 @@ impl Step {
8686 fn spawn_mode ( & self ) -> StepSpawn < ' _ > {
8787 match self {
8888 Self :: Command ( command) => StepSpawn :: Shell ( command. as_str ( ) ) ,
89- Self :: Detailed ( config) => {
90- if let Some ( argv) = & config. argv {
91- StepSpawn :: Direct ( argv)
92- } else if let Some ( command) = & config. command {
93- StepSpawn :: Shell ( command. as_str ( ) )
94- } else {
95- panic ! ( "step must have either 'command' or 'argv'" ) ;
96- }
97- }
89+ Self :: Detailed ( config) => config. argv . as_deref ( ) . map_or_else (
90+ || {
91+ StepSpawn :: Shell (
92+ config
93+ . command
94+ . as_ref ( )
95+ . expect ( "step must have either 'command' or 'argv'" )
96+ . as_str ( ) ,
97+ )
98+ } ,
99+ StepSpawn :: Direct ,
100+ ) ,
98101 }
99102 }
100103
104+ #[ expect( clippy:: disallowed_types, reason = "String required by join" ) ]
101105 fn display_command ( & self ) -> String {
102106 match self . spawn_mode ( ) {
103107 StepSpawn :: Shell ( cmd) => cmd. to_string ( ) ,
104- StepSpawn :: Direct ( argv) => {
105- argv. iter ( ) . map ( |a| a. as_str ( ) ) . collect :: < Vec < _ > > ( ) . join ( " " )
106- }
108+ StepSpawn :: Direct ( argv) => argv. iter ( ) . map ( Str :: as_str) . collect :: < Vec < _ > > ( ) . join ( " " ) ,
107109 }
108110 }
109111
@@ -467,12 +469,12 @@ fn run_case_inner(tmpdir: &AbsolutePath, fixture_path: &std::path::Path, fixture
467469}
468470
469471fn main ( ) {
470- // SAFETY: Called before any threads are spawned; insta reads this lazily on first assertion.
471472 // Skip INSTA_REQUIRE_FULL_MATCH when running cross-platform (via cargo-xtest): the snapshot
472473 // source metadata changes when the test binary runs on a remote machine, causing insta to
473474 // write .snap.new even when content matches. INSTA_UPDATE=always in this mode accepts
474475 // metadata-only changes.
475476 if std:: env:: var_os ( "INSTA_UPDATE" ) . is_none ( ) {
477+ // SAFETY: Called before any threads are spawned; insta reads this lazily on first assertion.
476478 unsafe { std:: env:: set_var ( "INSTA_REQUIRE_FULL_MATCH" , "1" ) } ;
477479 }
478480
0 commit comments