Skip to content

Commit

Permalink
add test ensuring only doc = "" attributes are normalized to comments
Browse files Browse the repository at this point in the history
The other shapes of doc attributes shouldn't be normalized or modified.
  • Loading branch information
lqd committed Sep 13, 2018
1 parent cbc5841 commit 0c73b94
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/source/doc-attrib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
// rustfmt-wrap_comments: true
// rustfmt-normalize_doc_attributes: true

// Only doc = "" attributes should be normalized
#![doc = "Example doc attribute comment"]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/", test(attr(deny(warnings))))]


// Long `#[doc = "..."]`
struct A { #[doc = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"] b: i32 }
Expand Down
8 changes: 8 additions & 0 deletions tests/target/doc-attrib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
// rustfmt-wrap_comments: true
// rustfmt-normalize_doc_attributes: true

// Only doc = "" attributes should be normalized
//! Example doc attribute comment
#![doc(
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings)))
)]

// Long `#[doc = "..."]`
struct A {
Expand Down

0 comments on commit 0c73b94

Please sign in to comment.