Skip to content

Commit aadd1e4

Browse files
committed
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.
1 parent 0917399 commit aadd1e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bindgen/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl std::fmt::Display for Formatter {
206206
Self::Prettyplease => "prettyplease",
207207
};
208208

209-
s.fmt(f)
209+
std::fmt::Display::fmt(&s, f)
210210
}
211211
}
212212

@@ -997,6 +997,12 @@ impl Bindings {
997997
cmd.args(["--config-path", path]);
998998
}
999999

1000+
let edition = self
1001+
.options
1002+
.rust_edition
1003+
.unwrap_or_else(|| self.options.rust_target.latest_edition());
1004+
cmd.args(["--edition", &format!("{edition}")]);
1005+
10001006
let mut child = cmd.spawn()?;
10011007
let mut child_stdin = child.stdin.take().unwrap();
10021008
let mut child_stdout = child.stdout.take().unwrap();

0 commit comments

Comments
 (0)