Skip to content

Commit

Permalink
Wire up fixups for precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 5, 2025
1 parent 90883a5 commit 4c029b5
Show file tree
Hide file tree
Showing 9 changed files with 395 additions and 213 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ verbatim = ["syn/parsing"]

[dependencies]
proc-macro2 = { version = "1.0.80", default-features = false }
syn = { version = "2.0.81", default-features = false, features = ["full"] }
syn = { version = "2.0.95", default-features = false, features = ["full"] }

[dev-dependencies]
indoc = "2"
proc-macro2 = { version = "1.0.80", default-features = false }
quote = { version = "1.0.35", default-features = false }
syn = { version = "2.0.81", default-features = false, features = ["parsing"] }
syn = { version = "2.0.95", default-features = false, features = ["parsing"] }

[lib]
doc-scrape-examples = false
Expand Down
3 changes: 2 additions & 1 deletion src/attr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::algorithm::Printer;
use crate::fixup::FixupContext;
use crate::path::PathKind;
use crate::INDENT;
use proc_macro2::{Delimiter, Group, TokenStream, TokenTree};
Expand Down Expand Up @@ -102,7 +103,7 @@ impl Printer {
fn meta_name_value(&mut self, meta: &MetaNameValue) {
self.path(&meta.path, PathKind::Simple);
self.word(" = ");
self.expr(&meta.value);
self.expr(&meta.value, FixupContext::NONE);
}

fn attr_tokens(&mut self, tokens: TokenStream) {
Expand Down
3 changes: 2 additions & 1 deletion src/data.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::algorithm::Printer;
use crate::fixup::FixupContext;
use crate::iter::IterDelimited;
use crate::path::PathKind;
use crate::INDENT;
Expand Down Expand Up @@ -31,7 +32,7 @@ impl Printer {
}
if let Some((_eq_token, discriminant)) = &variant.discriminant {
self.word(" = ");
self.expr(discriminant);
self.expr(discriminant, FixupContext::NONE);
}
}

Expand Down
Loading

0 comments on commit 4c029b5

Please sign in to comment.