Skip to content

test(rustfmt): Verify frontmatter is preserved #145766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions src/tools/rustfmt/tests/source/frontmatter_compact.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env cargo
---identifier
[dependencies]
regex = "1"
---
#![feature(frontmatter)]

fn main() {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check that the file as a whole is being formatted? I think rustfmt sometimes bails out on formatting just from the presence somewhere in the file of syntax... not sure if that's happening here or not (or quite what the test format here looks like).

It probably makes sense to try to get rustfmt team review (do you have someone to re-assign already?). Otherwise, if we think that's not feasible, happy to just rubberstamp.

16 changes: 16 additions & 0 deletions src/tools/rustfmt/tests/source/frontmatter_spaced.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env cargo


--- identifier
[dependencies]
regex = "1"

---





#![feature(frontmatter)]

fn main() {}
8 changes: 8 additions & 0 deletions src/tools/rustfmt/tests/target/frontmatter_compact.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env cargo
---identifier
[dependencies]
regex = "1"
---
#![feature(frontmatter)]

fn main() {}
16 changes: 16 additions & 0 deletions src/tools/rustfmt/tests/target/frontmatter_spaced.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env cargo


--- identifier
[dependencies]
regex = "1"

---





#![feature(frontmatter)]

fn main() {}
Loading