Skip to content

Commit

Permalink
Fix some clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw authored and David-OConnor committed Aug 27, 2020
1 parent dc91c9a commit 80331d0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/dep_parser.rs
Expand Up @@ -233,7 +233,7 @@ pub fn parse_req_type(input: &str) -> IResult<&str, ReqType> {
tag("~="),
tag("~"),
)),
|x| ReqType::from_str(x),
ReqType::from_str,
)(input)
}

Expand Down
50 changes: 27 additions & 23 deletions src/install.rs
Expand Up @@ -285,15 +285,13 @@ pub fn download_and_install_package(
.unwrap()
.to_lowercase()
.contains("readme")
&& fs::File::create(&paths.lib.join(f.path().unwrap()))
.is_err()
{
if let Err(_) =
fs::File::create(&paths.lib.join(f.path().unwrap()))
{
print_color(
"Problem creating dummy readme",
Color::DarkYellow,
);
}
print_color(
"Problem creating dummy readme",
Color::DarkYellow,
);
}
}
};
Expand Down Expand Up @@ -356,11 +354,13 @@ pub fn download_and_install_package(
.current_dir(&extracted_parent)
.args(&["setup.py", "bdist_wheel"])
.output()
.expect(&format!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent,
paths.bin.join("python")
));
.unwrap_or_else(|_| {
panic!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent,
paths.bin.join("python")
)
});
util::check_command_output_with(&output, |s| {
panic!(
"running setup.py bdist_wheel in folder {:?}. Py path: {:?}: {}",
Expand All @@ -376,11 +376,13 @@ pub fn download_and_install_package(
.current_dir(&extracted_parent)
.args(&["setup.py", "bdist_wheel"])
.output()
.expect(&format!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent,
paths.bin.join("python")
));
.unwrap_or_else(|_| {
panic!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent,
paths.bin.join("python")
)
});
util::check_command_output_with(&output, |s| {
panic!(
"running setup.py bdist_wheel in folder {:?}. Py path: {:?}: {}",
Expand All @@ -396,11 +398,13 @@ pub fn download_and_install_package(
.current_dir(&extracted_parent)
.args(&["setup.py", "bdist_wheel"])
.output()
.expect(&format!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent,
paths.bin.join("python")
));
.unwrap_or_else(|_| {
panic!(
"Problem running setup.py bdist_wheel in folder: {:?}. Py path: {:?}",
&extracted_parent,
paths.bin.join("python")
)
});
util::check_command_output_with(&output, |s| {
panic!(
"running setup.py bdist_wheel in folder {:?}. Py path: {:?}: {}",
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Expand Up @@ -1006,7 +1006,7 @@ fn run_script(
Err(_) => Lock::default(),
};

let lockpacks = lock.package.unwrap_or_else(|| vec![]);
let lockpacks = lock.package.unwrap_or_else(Vec::new);

let reqs: Vec<Req> = deps
.iter()
Expand Down Expand Up @@ -1463,7 +1463,7 @@ fn main() {
Err(_) => Lock::default(),
};

let lockpacks = lock.package.unwrap_or_else(|| vec![]);
let lockpacks = lock.package.unwrap_or_else(Vec::new);

sync(
&paths,
Expand Down Expand Up @@ -1583,7 +1583,7 @@ fn main() {
&paths,
&lockpacks,
&updated_reqs,
&cfg.dev_reqs.clone(),
&cfg.dev_reqs,
&[],
os,
&py_vers,
Expand Down

0 comments on commit 80331d0

Please sign in to comment.