From 60fdb028ce5244f9b32dbac0f74f035160b3ab56 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Tue, 9 Dec 2025 13:09:29 -0500 Subject: [PATCH] Incorporate suggestion from #1799 --- dylint/src/driver_builder.rs | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/dylint/src/driver_builder.rs b/dylint/src/driver_builder.rs index b99afbbd0..596e08dd6 100644 --- a/dylint/src/driver_builder.rs +++ b/dylint/src/driver_builder.rs @@ -23,32 +23,6 @@ Deleting this directory will cause Dylint to rebuild the drivers the next time it needs them, but will have no ill effects. "; -fn cargo_toml(toolchain: &str, dylint_driver_spec: &str) -> String { - format!( - r#" -[package] -name = "dylint_driver-{toolchain}" -version = "0.1.0" -edition = "2018" - -[dependencies] -anyhow = "1.0" -env_logger = "0.11" -dylint_driver = {{ {dylint_driver_spec} }} -"#, - ) -} - -fn rust_toolchain(toolchain: &str) -> String { - format!( - r#" -[toolchain] -channel = "{toolchain}" -components = ["llvm-tools-preview", "rustc-dev"] -"#, - ) -} - // smoelius: We need `#![feature(rustc_private)]` as it changes `dylib` linking behavior and allows // us to link to `rustc_driver`. See: https://github.com/rust-lang/rust/pull/122362 const MAIN_RS: &str = r" @@ -238,6 +212,32 @@ fn initialize(toolchain: &str, package: &Path) -> Result<()> { Ok(()) } +fn cargo_toml(toolchain: &str, dylint_driver_spec: &str) -> String { + format!( + r#" +[package] +name = "dylint_driver-{toolchain}" +version = "0.1.0" +edition = "2018" + +[dependencies] +anyhow = "1.0" +env_logger = "0.11" +dylint_driver = {{ {dylint_driver_spec} }} +"#, + ) +} + +fn rust_toolchain(toolchain: &str) -> String { + format!( + r#" +[toolchain] +channel = "{toolchain}" +components = ["llvm-tools-preview", "rustc-dev"] +"#, + ) +} + #[allow(clippy::unwrap_used)] #[cfg(test)] mod test {