From 59a43e10b758bd86275aefceae29e874157087d8 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 8a7453bbcd..9e22e37ce6 100644 --- a/bindgen/lib.rs +++ b/bindgen/lib.rs @@ -208,7 +208,7 @@ impl std::fmt::Display for Formatter { Self::Prettyplease => "prettyplease", }; - s.fmt(f) + std::fmt::Display::fmt(&s, f) } } @@ -999,6 +999,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();