From 136fee269fa5779279128d89175ff3ed12e57f4c Mon Sep 17 00:00:00 2001 From: Owen Leung Date: Tue, 13 Aug 2024 16:45:42 +0800 Subject: [PATCH] Fix failing cargo fmt and ruff CI jobs --- maturin/__init__.py | 1 - src/build_context.rs | 2 +- src/main.rs | 15 +++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/maturin/__init__.py b/maturin/__init__.py index 495d50e02..c17ff1272 100644 --- a/maturin/__init__.py +++ b/maturin/__init__.py @@ -18,7 +18,6 @@ import struct import subprocess import sys -from subprocess import SubprocessError from typing import Any, Dict, Mapping, List, Optional try: diff --git a/src/build_context.rs b/src/build_context.rs index d959d0a28..e5274e544 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -1187,7 +1187,7 @@ impl BuildContext { { let current_path = env::var("PATH").unwrap_or_default(); let new_path = format!("{}:{}", cargo_bin_path.display(), current_path); - unsafe {env::set_var("PATH", &new_path)}; + unsafe { env::set_var("PATH", &new_path) }; Command::new(cargo_bin_path.join("rustup")) .arg("default") .arg("stable") diff --git a/src/main.rs b/src/main.rs index 11ba0c441..ac276e167 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,14 +12,14 @@ use clap::CommandFactory; use clap::{Parser, Subcommand}; #[cfg(feature = "rustls")] use dirs::home_dir; +#[cfg(feature = "rustls")] +use maturin::BuildContext; #[cfg(feature = "scaffolding")] use maturin::{ci::GenerateCI, init_project, new_project, GenerateProjectOptions}; use maturin::{ - develop, write_dist_info, BridgeModel, BuildOptions, CargoOptions, - DevelopOptions, PathWriter, PlatformTag, PythonInterpreter, Target, + develop, write_dist_info, BridgeModel, BuildOptions, CargoOptions, DevelopOptions, PathWriter, + PlatformTag, PythonInterpreter, Target, }; -#[cfg(feature = "rustls")] -use maturin::BuildContext; #[cfg(feature = "schemars")] use maturin::{generate_json_schema, GenerateJsonSchemaOptions}; #[cfg(feature = "upload")] @@ -280,10 +280,13 @@ fn pep517(subcommand: Pep517Command) -> Result<()> { #[cfg(feature = "rustls")] if !BuildContext::is_toolchain_installed() { let home_dir = home_dir().context("Unabel to get user home directory")?; - let home_dir_str = home_dir.to_str().context("Unable to convert home directory string")?; + let home_dir_str = home_dir + .to_str() + .context("Unable to convert home directory string")?; BuildContext::download_and_execute_rustup(home_dir_str, home_dir_str) .context("Unable to install & execute rustup")?; - BuildContext::add_cargo_to_path(home_dir_str).context("Unable to add cargo path")?; + BuildContext::add_cargo_to_path(home_dir_str) + .context("Unable to add cargo path")?; } let context = build_options.into_build_context(true, strip, false)?;