From 21db60ee7fc7945fc917df3a6a7111c6f7e7e3b3 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sun, 31 Dec 2023 14:35:00 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20Use=20nightly=20when=20opininated=20rust?= =?UTF-8?q?fmt=20is=20chosen=20=F0=9F=90=9B=20(#32)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- async/template/hooks/pre-get-repository.rhai | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/async/template/hooks/pre-get-repository.rhai b/async/template/hooks/pre-get-repository.rhai index 57414a5..081b8af 100644 --- a/async/template/hooks/pre-get-repository.rhai +++ b/async/template/hooks/pre-get-repository.rhai @@ -75,16 +75,13 @@ let use_rustfmt = if variable::is_set("use_rustfmt") { variable::prompt("Use an opinionated rustfmt.toml file?", "false", ["true", "false"]) }; -if use_rustfmt == "true" || use_rustfmt == true { +if use_rustfmt == "false" || use_rustfmt == false { file::delete("./.rustfmt.toml"); +} else { + print("!!! opinionated rustfmt.toml requires nightly."); + variable::set("msrv", "nightly"); } -let project_name = variable::get("project-name"); -let crate_name = project_name; -crate_name.replace("-", "_"); -crate_name.replace(" ", "_"); -variable::set("crate_name", crate_name); - let msrv = if variable::is_set("msrv") { variable::get("msrv") } else { @@ -92,4 +89,10 @@ let msrv = if variable::is_set("msrv") { }; variable::set("msrv", msrv); +let project_name = variable::get("project-name"); +let crate_name = project_name; +crate_name.replace("-", "_"); +crate_name.replace(" ", "_"); +variable::set("crate_name", crate_name); + file::delete("./hooks");