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

Commit 1d9104b

Browse files
committed
reflect scampi review
- fix README.md - fix BadAttr doc - is_rustfmt_macro_error => is_unknown_rustfmt_attr
1 parent bbbc1e8 commit 1d9104b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ needs to be specified in `rustfmt.toml`, e.g., with `edition = "2018"`.
205205
| coverage | displays how much of the input file was processed | Yes |
206206
| checkstyle | emits in a checkstyle format | Yes |
207207

208-
* For things you do not want rustfmt to mangle for some macro,
208+
* To prevent rustfmt from formatting a macro,
209209
use `#[rustfmt::skip::macros(target_macro_name)]`
210210

211211
Example:

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub enum ErrorKind {
9494
/// Used deprecated skip attribute.
9595
#[fail(display = "`rustfmt_skip` is deprecated; use `rustfmt::skip`")]
9696
DeprecatedAttr,
97-
/// Used a rustfmt:: attribute other than skip.
97+
/// Used a rustfmt:: attribute other than skip or skip::macros.
9898
#[fail(display = "invalid attribute")]
9999
BadAttr,
100100
/// An io error during reading or writing.

src/visitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
659659
ErrorKind::DeprecatedAttr,
660660
)],
661661
);
662-
} else if self.is_rustfmt_macro_error(&attr.path.segments) {
662+
} else if self.is_unknown_rustfmt_attr(&attr.path.segments) {
663663
let file_name = self.source_map.span_to_filename(attr.span).into();
664664
self.report.append(
665665
file_name,
@@ -687,7 +687,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
687687
false
688688
}
689689

690-
fn is_rustfmt_macro_error(&self, segments: &[ast::PathSegment]) -> bool {
690+
fn is_unknown_rustfmt_attr(&self, segments: &[ast::PathSegment]) -> bool {
691691
if segments[0].ident.to_string() != "rustfmt" {
692692
return false;
693693
}

0 commit comments

Comments
 (0)