diff --git a/Cargo.toml b/Cargo.toml index 4b34863..49d7a84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,22 +80,46 @@ pretty_assertions = { version = "1.4.0", default-features = false, features = [ tempfile = { version = "3.12.0", default-features = false } [lints.rust] -rust-2018-idioms = "warn" +elided_lifetimes_in_paths = "warn" +keyword_idents = "warn" +macro_use_extern_crate = "warn" +meta_variable_misuse = "warn" +redundant_lifetimes = "warn" +rust_2018_idioms = "warn" +trivial_casts = "warn" +trivial_numeric_casts = "warn" +unit_bindings = "warn" unreachable_pub = "warn" unused_qualifications = "warn" +variant_size_differences = "warn" [lints.clippy] assigning_clones = "warn" +cast_lossless = "warn" +cloned_instead_of_copied = "warn" +derive_partial_eq_without_eq = "warn" doc_markdown = "warn" +equatable_if_let = "warn" +explicit_iter_loop = "warn" +flat_map_option = "warn" format_push_string = "warn" +ignored_unit_patterns = "warn" +manual_assert = "warn" +manual_let_else = "warn" +manual_string_new = "warn" needless_pass_by_value = "warn" +or_fun_call = "warn" ptr_as_ptr = "warn" redundant_clone = "warn" redundant_closure_for_method_calls = "warn" +redundant_else = "warn" semicolon_if_nothing_returned = "warn" +type_repetition_in_bounds = "warn" undocumented_unsafe_blocks = "warn" uninlined_format_args = "warn" unnecessary_box_returns = "warn" unnecessary_safety_doc = "warn" +unnested_or_patterns = "warn" unwrap_used = "warn" +use_self = "warn" wildcard_imports = "warn" diff --git a/src/config.rs b/src/config.rs index 0bd2469..5df2328 100644 --- a/src/config.rs +++ b/src/config.rs @@ -171,7 +171,7 @@ pub(crate) fn parse_for_merge(src: &str) -> anyhow::Result> { } Ok(Config { - source: source.ok_or(anyhow!("No source directive found"))?, + source: source.ok_or_else(|| anyhow!("No source directive found"))?, mutations: builder.build()?, }) } @@ -225,7 +225,7 @@ pub(crate) fn parse_for_add(src: &str) -> Result, anyhow:: } Ok(Config { - source: source.ok_or(anyhow!("No source directive found"))?, + source: source.ok_or_else(|| anyhow!("No source directive found"))?, mutations: builder.build()?, }) } diff --git a/src/doctor.rs b/src/doctor.rs index 86d5ef4..5f7cbe9 100644 --- a/src/doctor.rs +++ b/src/doctor.rs @@ -207,7 +207,7 @@ fn chezmoi_version_override_check( fn check_has_ignore() -> Result<(CheckResult, String), Box> { if which::which("chezmoi").is_ok() { let src_path = RealChezmoi::default().source_root()?; - let mut src_path = src_path.ok_or(anyhow!("No chezmoi source root found"))?; + let mut src_path = src_path.ok_or_else(|| anyhow!("No chezmoi source root found"))?; src_path.push(".chezmoiignore"); let file = File::open(src_path)?; let mut reader = BufReader::new(file);