Skip to content

Commit

Permalink
chore(turborepo): Fixed clippy warnings (#4744)
Browse files Browse the repository at this point in the history
### Description

Fixing all the random clippy warnings that made it into our code.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
NicholasLYang committed Apr 28, 2023
1 parent a64b0c1 commit a3c49c4
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
6 changes: 3 additions & 3 deletions crates/turbopath/src/absolute_system_path_buf.rs
Expand Up @@ -166,9 +166,9 @@ impl AbsoluteSystemPathBuf {
}
}

impl Into<PathBuf> for AbsoluteSystemPathBuf {
fn into(self) -> PathBuf {
self.0
impl From<AbsoluteSystemPathBuf> for PathBuf {
fn from(path: AbsoluteSystemPathBuf) -> Self {
path.0
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/turbopath/src/anchored_system_path_buf.rs
Expand Up @@ -44,8 +44,8 @@ impl AnchoredSystemPathBuf {
}
}

impl Into<PathBuf> for AnchoredSystemPathBuf {
fn into(self) -> PathBuf {
self.0
impl From<AnchoredSystemPathBuf> for PathBuf {
fn from(path: AnchoredSystemPathBuf) -> PathBuf {
path.0
}
}
9 changes: 2 additions & 7 deletions crates/turborepo-lib/src/cli.rs
Expand Up @@ -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)]
Expand Down
12 changes: 5 additions & 7 deletions crates/turborepo-lib/src/commands/link.rs
Expand Up @@ -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!(
Expand All @@ -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!(
Expand All @@ -240,7 +238,7 @@ pub async fn link(
)
);

return Ok(());
Ok(())
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions crates/turborepo-lib/src/formatter.rs
Expand Up @@ -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::<Red, Black>(writer.by_ref(), self.is_ansi, level.as_str())
.and_then(|_| write_message::<Red, Default>(writer, self.is_ansi, event))
}
&Level::WARN => {
Level::WARN => {
write_string::<Yellow, Black>(writer.by_ref(), self.is_ansi, level.as_str())
.and_then(|_| write_message::<Yellow, Default>(writer, self.is_ansi, event))
}
&Level::INFO => write_message::<Default, Default>(writer, self.is_ansi, event),
Level::INFO => write_message::<Default, Default>(writer, self.is_ansi, event),
// trace and debug use the same style
_ => {
let now = Local::now();
Expand Down
4 changes: 2 additions & 2 deletions crates/turborepo-scm/src/git.rs
Expand Up @@ -74,7 +74,7 @@ fn execute_git_command(
pathspec: &str,
) -> Result<Vec<u8>, 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);

Expand All @@ -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);
}
}
Expand Down

0 comments on commit a3c49c4

Please sign in to comment.