Skip to content

Commit

Permalink
IDL: Disable rustfmt when expanding the code to parse IDL from (#24)
Browse files Browse the repository at this point in the history
Apparently, the newest rustfmt doesn't like the account constraint
syntax in Anchor.

This code:

```rust
\#[account(constraint = foo == bar @ ErrorCode::Baz)]
```

After rustfmt, becomes:

```rust
\#[account(constraint = foo = = bar @ ErrorCode::Baz)]
```

So it splits `==` to `= =`. syn is able to parse the former, but
not the latter.

This looks like a bug in rustfmt, but for now, let's disable it
as a workaround.
  • Loading branch information
vadorovsky authored Jun 22, 2023
1 parent 89d86a6 commit 69e6ad3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lang/syn/src/parser/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ impl ParsedModule {
) -> Result<BTreeMap<String, ParsedModule>, anyhow::Error> {
let mut modules = BTreeMap::new();

let mut args = Vec::with_capacity(2);
let mut args = Vec::with_capacity(3);
args.push("--ugly".to_owned());
if let Some(features) = features {
args.push("--features".to_owned());
args.push(features.join(","));
Expand Down

0 comments on commit 69e6ad3

Please sign in to comment.