Buncha clippy stuff

main
Michal 2 years ago
parent f6f7656caa
commit 8d93464d87
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -11,7 +11,6 @@ use std::process::Command;
use crate::args::{Args, Operation};
use crate::internal::AppExitCode;
use crate::repository::create_config;
use crate::internal::parse_cfg;
#[global_allocator]

@ -37,14 +37,8 @@ pub fn build(packages: &[String], exclude: Vec<String>, no_regen: bool, verbose:
if !packages.is_empty() && !all {
log!(verbose, "Packages not empty: {:?}", packages);
for pkg in packages.iter() {
// If repo is not in config, crash
if !repos.iter().map(|x| x.name.clone()).any(|x| x == *pkg) {
crash!(
AppExitCode::PkgNotFound,
"Package repo {} not found in in mlc.toml",
pkg
);
} else {
// If repo is not in config, crash, otherwise, build
if repos.iter().map(|x| x.name.clone()).any(|x| x == *pkg) {
// Otherwise, build
log!(verbose, "Building {}", pkg);
let code = repository::build(pkg, sign, verbose);
@ -61,6 +55,12 @@ pub fn build(packages: &[String], exclude: Vec<String>, no_regen: bool, verbose:
};
errored.push(error);
}
} else {
crash!(
AppExitCode::PkgNotFound,
"Package repo {} not found in in mlc.toml",
pkg
);
}
}
}

@ -2,13 +2,13 @@ use std::env;
use std::path::Path;
use std::process::Command;
use crate::{create_config, log};
use crate::{repository::create, log};
pub fn config(verbose: bool) {
// Generate new config file if not already present
if !Path::exists("mlc.toml".as_ref()) {
log!(verbose, "Creating mlc.toml");
create_config(verbose);
create(verbose);
}
// Open config file in user's editor of choice

@ -40,9 +40,7 @@ pub fn info(verbose: bool) {
log!(verbose, "Repos Sorted: {:?}", repos);
// Displaying basic info about the Malachite Repository
let internal_name = if !config.mode.repository.name.is_empty() {
config.mode.repository.name
} else {
let internal_name = if config.mode.repository.name.is_empty() {
env::current_dir()
.unwrap()
.file_name()
@ -50,6 +48,8 @@ pub fn info(verbose: bool) {
.to_str()
.unwrap()
.to_string()
} else {
config.mode.repository.name
};
let name = format!(
"{} \"{}\":",

@ -110,12 +110,12 @@ pub fn prune(verbose: bool) {
log!(verbose, "Current dir: {:?}", env::current_dir().unwrap());
// Print which packages were deleted
if !packages_to_delete.is_empty() {
if packages_to_delete.is_empty() {
info!("No packages were deleted.");
} else {
info!("Deleted the following packages:");
for p in &mut packages_to_delete {
info!("{}-{}", p.name.replace("./", ""), p.ver);
}
} else {
info!("No packages were deleted.");
}
}

@ -39,7 +39,7 @@ urls = [
""
]"#;
pub fn create_config(verbose: bool) {
pub fn create(verbose: bool) {
// Ensure current directory is empty
if env::current_dir()
.unwrap()

Loading…
Cancel
Save