Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion varlink_generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub struct GeneratorOptions {
pub string_type: Option<&'static str>,
pub preamble: Option<TokenStream>,
pub generate_async: bool,
pub fmt_edition: Option<&'static str>,
}

impl<'short, 'long: 'short> ToRustString<'short, 'long> for VType<'long> {
Expand Down Expand Up @@ -1317,6 +1318,7 @@ pub fn cargo_build_tosource<T: AsRef<Path> + ?Sized>(input_path: &T, rustfmt: bo
/// true,
/// &varlink_generator::GeneratorOptions {
/// int_type: Some("i128"),
/// fmt_edition: Some("2021"),
/// ..Default::default()
/// },
/// );
Expand Down Expand Up @@ -1368,8 +1370,10 @@ pub fn cargo_build_tosource_options<T: AsRef<Path> + ?Sized>(
}

if rustfmt {
let edition = options.fmt_edition.unwrap_or("2018");
if let Err(e) = Command::new("rustfmt")
.arg("--edition=2018")
.arg("--edition")
.arg(edition)
.arg(rust_path.to_str().unwrap())
.output()
{
Expand Down
Loading