From 5613870e6de4089aa4048fadba2c7e510c373a97 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Fri, 7 Jan 2022 23:00:45 -0500 Subject: [PATCH] Add support for rust-toolchain.toml --- src/args.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/args.ts b/src/args.ts index f89ed19..82bb873 100644 --- a/src/args.ts +++ b/src/args.ts @@ -19,13 +19,19 @@ function determineToolchain(overrideFile: string): string { return toolchainInput; } - if (!existsSync(overrideFile)) { + const toolchainPath = existsSync(overrideFile) + ? overrideFile + : existsSync(`${overrideFile}.toml`) + ? `${overrideFile}.toml` + : undefined; + + if (!toolchainPath) { throw new Error( "toolchain input was not given and repository does not have a rust-toolchain file" ); } - const rustToolchainFile = readFileSync(overrideFile, { + const rustToolchainFile = readFileSync(toolchainPath, { encoding: "utf-8", flag: "r", }).trim();