Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0c73b94

Browse files
committed
add test ensuring only doc = "" attributes are normalized to comments
The other shapes of doc attributes shouldn't be normalized or modified.
1 parent cbc5841 commit 0c73b94

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/source/doc-attrib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
// rustfmt-wrap_comments: true
22
// rustfmt-normalize_doc_attributes: true
33

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

612
// Long `#[doc = "..."]`
713
struct A { #[doc = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"] b: i32 }

tests/target/doc-attrib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
// rustfmt-wrap_comments: true
22
// rustfmt-normalize_doc_attributes: true
33

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

614
// Long `#[doc = "..."]`
715
struct A {

0 commit comments

Comments
 (0)