diff --git a/src/bin/ion/commands/new.rs b/src/bin/ion/commands/new.rs index 2e59a2d..b2bf661 100644 --- a/src/bin/ion/commands/new.rs +++ b/src/bin/ion/commands/new.rs @@ -66,7 +66,7 @@ pub fn exec(config: &mut Config, matches: &ArgMatches) -> CliResult { }; mk_package_dir(&path, force)?; - let mut ctx = Context::new(prompt, Julia::new(&config), Project::new(package, path)); + let mut ctx = Context::new(prompt, Julia::new(config), Project::new(package, path)); let name = matches.get_one::("template").unwrap().to_owned(); let template = Template::from_name(config, &name)?; if let Err(e) = template.render(config, &mut ctx) { diff --git a/src/ion/blueprints/context.rs b/src/ion/blueprints/context.rs index ff5767d..68f0907 100644 --- a/src/ion/blueprints/context.rs +++ b/src/ion/blueprints/context.rs @@ -142,7 +142,7 @@ impl Context { } std::fs::create_dir_all(&path).unwrap(); - let version = julia_version(&config)?; + let version = julia_version(config)?; let compat = format!("{}.{}", version.major, version.minor); let julia = Julia { version: version.to_string(), diff --git a/src/ion/blueprints/info.rs b/src/ion/blueprints/info.rs index fb205ea..26134a1 100644 --- a/src/ion/blueprints/info.rs +++ b/src/ion/blueprints/info.rs @@ -18,7 +18,7 @@ pub struct Julia { impl Julia { pub fn new(config: &Config) -> Self { - let version = match julia_version(&config) { + let version = match julia_version(config) { Ok(version) => version, Err(_) => node_semver::Version::parse("1.6.0").unwrap(), }; diff --git a/src/ion/utils/julia.rs b/src/ion/utils/julia.rs index 1a91f51..b5a2152 100644 --- a/src/ion/utils/julia.rs +++ b/src/ion/utils/julia.rs @@ -138,7 +138,7 @@ mod test { pub fn assert_julia_version(config: &Config, version_spec: impl AsRef) -> Result<()> { let range = node_semver::Range::parse(version_spec.as_ref()).expect("Invalid version spec"); let version = julia_version(config)?; - range.satisfies(&version).then(|| ()).ok_or_else(|| { + range.satisfies(&version).then_some(()).ok_or_else(|| { format_err!( "Invalid Julia version: Julia version {version} does not satisfy version range {range}", ) diff --git a/tests/bin/utils.rs b/tests/bin/utils.rs index 11e9713..040c159 100644 --- a/tests/bin/utils.rs +++ b/tests/bin/utils.rs @@ -15,6 +15,8 @@ pub struct Ion { cmd: Command, } + + impl Ion { pub fn new() -> Self { let program = cargo_bin("ion"); @@ -87,12 +89,18 @@ impl Ion { } } +impl Default for Ion { + fn default() -> Self { + Self::new() + } +} + impl<'c> OutputAssertExt for &'c mut Ion { fn assert(self) -> Assert { let output = match self.output() { Ok(output) => output, Err(err) => { - panic!("Failed to spawn {:?}: {}", self, err); + panic!("Failed to spawn {self:?}: {err}"); } }; Assert::new(output).append_context("command", format!("{:?}", self.cmd))