Skip to content

Commit

Permalink
revert: unwanted translations in src/utils.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC committed Sep 22, 2024
1 parent 35f2561 commit 5b701d0
Showing 1 changed file with 10 additions and 40 deletions.
50 changes: 10 additions & 40 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ where
{
fn if_exists(self) -> Option<Self> {
if self.as_ref().exists() {
debug!("{}", t!("Path {path} exists", path = format!("{:?}", self.as_ref())));
debug!("Path {:?} exists", self.as_ref());
Some(self)
} else {
debug!(
"{}",
t!("Path {path} doesn't exist", path = format!("{:?}", self.as_ref()))
);
debug!("Path {:?} doesn't exist", self.as_ref());
None
}
}
Expand All @@ -52,7 +49,7 @@ where

fn require(self) -> Result<Self> {
if self.as_ref().exists() {
debug!("{}", t!("Path {path} exists", path = format!("{:?}", self.as_ref())));
debug!("Path {:?} exists", self.as_ref());
Ok(self)
} else {
Err(SkipStep(format!(
Expand All @@ -67,33 +64,16 @@ where
pub fn which<T: AsRef<OsStr> + Debug>(binary_name: T) -> Option<PathBuf> {
match which_crate::which(&binary_name) {
Ok(path) => {
debug!(
"{}",
t!(
"Detected {path} as {binary_name}",
path = format!("{:?}", &path),
binary_name = format!("{:?}", &binary_name)
)
);
debug!("Detected {:?} as {:?}", &path, &binary_name);
Some(path)
}
Err(e) => {
match e {
which_crate::Error::CannotFindBinaryPath => {
debug!(
"{}",
t!("Cannot find {binary_name}", binary_name = format!("{:?}", &binary_name))
);
debug!("Cannot find {:?}", &binary_name);
}
_ => {
error!(
"{} {}",
t!(
"Detecting {binary_name} failed: ",
binary_name = format!("{:?}", &binary_name)
),
e
);
error!("Detecting {:?} failed: {}", &binary_name, e);
}
}

Expand All @@ -113,14 +93,7 @@ pub fn editor() -> Vec<String> {
pub fn require<T: AsRef<OsStr> + Debug>(binary_name: T) -> Result<PathBuf> {
match which_crate::which(&binary_name) {
Ok(path) => {
debug!(
"{}",
t!(
"Detected {path} as {binary_name}",
path = format!("{:?}", &path),
binary_name = format!("{:?}", &binary_name)
)
);
debug!("Detected {:?} as {:?}", &path, &binary_name);
Ok(path)
}
Err(e) => match e {
Expand All @@ -133,10 +106,7 @@ pub fn require<T: AsRef<OsStr> + Debug>(binary_name: T) -> Result<PathBuf> {
))
.into()),
_ => {
panic!(
"{}",
t!("Path {path} exists", binary_name = format!("{:?}", &binary_name))
);
panic!("Detecting {:?} failed: {}", &binary_name, e);
}
},
}
Expand Down Expand Up @@ -256,9 +226,9 @@ pub fn check_is_python_2_or_shim(python: PathBuf) -> Result<PathBuf> {
let major_version = version
.split('.')
.next()
.unwrap_or_else(|| panic!("{}", t!("Should have a major version number").as_ref().to_string()))
.expect("Should have a major version number")
.parse::<u32>()
.unwrap_or_else(|_| panic!("{}", t!("Major version should be a valid number").as_ref().to_string()));
.expect("Major version should be a valid number");
if major_version == 2 {
return Err(SkipStep(t!("{python} is a Python 2, skip.", python = python.display()).to_string()).into());
}
Expand Down

0 comments on commit 5b701d0

Please sign in to comment.