diff --git a/crates/turbopath/src/absolute_system_path_buf.rs b/crates/turbopath/src/absolute_system_path_buf.rs index 5c0194446d09b..b695a47bbb942 100644 --- a/crates/turbopath/src/absolute_system_path_buf.rs +++ b/crates/turbopath/src/absolute_system_path_buf.rs @@ -166,9 +166,9 @@ impl AbsoluteSystemPathBuf { } } -impl Into for AbsoluteSystemPathBuf { - fn into(self) -> PathBuf { - self.0 +impl From for PathBuf { + fn from(path: AbsoluteSystemPathBuf) -> Self { + path.0 } } diff --git a/crates/turbopath/src/anchored_system_path_buf.rs b/crates/turbopath/src/anchored_system_path_buf.rs index 6b9e67aed986d..fe8e0c06e2b07 100644 --- a/crates/turbopath/src/anchored_system_path_buf.rs +++ b/crates/turbopath/src/anchored_system_path_buf.rs @@ -44,8 +44,8 @@ impl AnchoredSystemPathBuf { } } -impl Into for AnchoredSystemPathBuf { - fn into(self) -> PathBuf { - self.0 +impl From for PathBuf { + fn from(path: AnchoredSystemPathBuf) -> PathBuf { + path.0 } } diff --git a/crates/turborepo-lib/src/cli.rs b/crates/turborepo-lib/src/cli.rs index 92c05fe9d8265..91b44ddde3479 100644 --- a/crates/turborepo-lib/src/cli.rs +++ b/crates/turborepo-lib/src/cli.rs @@ -52,19 +52,14 @@ pub enum DryRunMode { Json, } -#[derive(Copy, Clone, Debug, PartialEq, Serialize, ValueEnum)] +#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, ValueEnum)] pub enum EnvMode { + #[default] Infer, Loose, Strict, } -impl Default for EnvMode { - fn default() -> EnvMode { - EnvMode::Infer - } -} - #[derive(Parser, Clone, Default, Debug, PartialEq, Serialize)] #[clap(author, about = "The build system that makes ship happen", long_about = None)] #[clap(disable_help_subcommand = true)] diff --git a/crates/turborepo-lib/src/commands/link.rs b/crates/turborepo-lib/src/commands/link.rs index 80948fb878aad..52e06c77a6481 100644 --- a/crates/turborepo-lib/src/commands/link.rs +++ b/crates/turborepo-lib/src/commands/link.rs @@ -190,7 +190,7 @@ pub async fn link( base.ui.apply(BOLD.apply_to(chosen_team_name)), GREY.apply_to("To disable Remote Caching, run `npx turbo unlink`") ); - return Ok(()); + Ok(()) } LinkTarget::Spaces => { println!( @@ -213,17 +213,15 @@ pub async fn link( let selected_space = select_space(base, &spaces_response.spaces)?; // print result from selected_space - let space = match selected_space { - SelectedSpace::Space(space) => space, - }; + let SelectedSpace::Space(space) = selected_space; add_space_id_to_turbo_json(base, &space.id).map_err(|err| { - return anyhow!( + anyhow!( "Could not persist selected space ({}) to `experimentalSpaces.id` in \ turbo.json {}", space.id, err - ); + ) })?; println!( @@ -240,7 +238,7 @@ pub async fn link( ) ); - return Ok(()); + Ok(()) } } } diff --git a/crates/turborepo-lib/src/formatter.rs b/crates/turborepo-lib/src/formatter.rs index aaebb2c3c644f..069698285ee18 100644 --- a/crates/turborepo-lib/src/formatter.rs +++ b/crates/turborepo-lib/src/formatter.rs @@ -46,16 +46,16 @@ where let level = event.metadata().level(); let target = event.metadata().target(); - match level { - &Level::ERROR => { + match *level { + Level::ERROR => { write_string::(writer.by_ref(), self.is_ansi, level.as_str()) .and_then(|_| write_message::(writer, self.is_ansi, event)) } - &Level::WARN => { + Level::WARN => { write_string::(writer.by_ref(), self.is_ansi, level.as_str()) .and_then(|_| write_message::(writer, self.is_ansi, event)) } - &Level::INFO => write_message::(writer, self.is_ansi, event), + Level::INFO => write_message::(writer, self.is_ansi, event), // trace and debug use the same style _ => { let now = Local::now(); diff --git a/crates/turborepo-scm/src/git.rs b/crates/turborepo-scm/src/git.rs index a4686f00ecf75..7ad5648d24b5c 100644 --- a/crates/turborepo-scm/src/git.rs +++ b/crates/turborepo-scm/src/git.rs @@ -74,7 +74,7 @@ fn execute_git_command( pathspec: &str, ) -> Result, Error> { let mut command = Command::new("git"); - command.args(args).current_dir(&git_root); + command.args(args).current_dir(git_root); add_pathspec(&mut command, pathspec); @@ -89,7 +89,7 @@ fn execute_git_command( } fn add_pathspec(command: &mut Command, pathspec: &str) { - if pathspec != "" { + if !pathspec.is_empty() { command.arg("--").arg(pathspec); } }