From aadd1e48f80dbce1d2a307d7e8959613e0bdfe16 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Thu, 26 Dec 2024 21:45:26 -0500 Subject: [PATCH] Use appropriate `rustfmt --format ...` param This fixes the issue with c-string literals which require edition 2021. Now the edition is automatically computed if not specified. --- bindgen/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bindgen/lib.rs b/bindgen/lib.rs index c9b529ac66..5fea4fc198 100644 --- a/bindgen/lib.rs +++ b/bindgen/lib.rs @@ -206,7 +206,7 @@ impl std::fmt::Display for Formatter { Self::Prettyplease => "prettyplease", }; - s.fmt(f) + std::fmt::Display::fmt(&s, f) } } @@ -997,6 +997,12 @@ impl Bindings { cmd.args(["--config-path", path]); } + let edition = self + .options + .rust_edition + .unwrap_or_else(|| self.options.rust_target.latest_edition()); + cmd.args(["--edition", &format!("{edition}")]); + let mut child = cmd.spawn()?; let mut child_stdin = child.stdin.take().unwrap(); let mut child_stdout = child.stdout.take().unwrap();