Skip to content

Commit a9d7cd5

Browse files
authored
Remove report_todo and report_fixme (#4129)
1 parent 4138fd5 commit a9d7cd5

File tree

8 files changed

+3
-389
lines changed

8 files changed

+3
-389
lines changed

Configurations.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,35 +1888,6 @@ mod sit;
18881888
**Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantics
18891889
of the original source code.
18901890

1891-
## `report_fixme`
1892-
1893-
Report `FIXME` items in comments.
1894-
1895-
- **Default value**: `"Never"`
1896-
- **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1897-
- **Stable**: No (tracking issue: [#3394](https://github.com/rust-lang/rustfmt/issues/3394))
1898-
1899-
Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1900-
it contains a `#X` (with `X` being a number) in parentheses following the
1901-
`FIXME`, `"Unnumbered"` will ignore it.
1902-
1903-
See also [`report_todo`](#report_todo).
1904-
1905-
1906-
## `report_todo`
1907-
1908-
Report `TODO` items in comments.
1909-
1910-
- **Default value**: `"Never"`
1911-
- **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1912-
- **Stable**: No (tracking issue: [#3393](https://github.com/rust-lang/rustfmt/issues/3393))
1913-
1914-
Warns about any comments containing `TODO` in them when set to `"Always"`. If
1915-
it contains a `#X` (with `X` being a number) in parentheses following the
1916-
`TODO`, `"Unnumbered"` will ignore it.
1917-
1918-
See also [`report_fixme`](#report_fixme).
1919-
19201891
## `required_version`
19211892

19221893
Require a specific version of rustfmt. If you want to make sure that the

rustfmt-core/rustfmt-lib/src/config.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@ create_config! {
149149
error_on_unformatted: bool, false, false,
150150
"Error if unable to get comments or string literals within max_width, \
151151
or they are left with trailing whitespaces";
152-
report_todo: ReportTactic, ReportTactic::Never, false,
153-
"Report all, none or unnumbered occurrences of TODO in source file comments";
154-
report_fixme: ReportTactic, ReportTactic::Never, false,
155-
"Report all, none or unnumbered occurrences of FIXME in source file comments";
156152
ignore: IgnoreList, IgnoreList::default(), false,
157153
"Skip formatting the specified files and directories";
158154

@@ -579,8 +575,6 @@ disable_all_formatting = false
579575
hide_parse_errors = false
580576
error_on_line_overflow = false
581577
error_on_unformatted = false
582-
report_todo = "Never"
583-
report_fixme = "Never"
584578
ignore = []
585579
"#,
586580
env!("CARGO_PKG_VERSION")

rustfmt-core/rustfmt-lib/src/format_report_formatter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,6 @@ fn error_kind_to_snippet_annotation_type(error_kind: &ErrorKind) -> AnnotationTy
168168
| ErrorKind::BadAttr
169169
| ErrorKind::InvalidGlobPattern(_)
170170
| ErrorKind::VersionMismatch => AnnotationType::Error,
171-
ErrorKind::BadIssue(_) | ErrorKind::DeprecatedAttr => AnnotationType::Warning,
171+
ErrorKind::DeprecatedAttr => AnnotationType::Warning,
172172
}
173173
}

rustfmt-core/rustfmt-lib/src/formatting.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use rustc_span::Span;
1010
use self::newline_style::apply_newline_style;
1111
use crate::comment::{CharClasses, FullCodeCharKind};
1212
use crate::config::{Config, FileName, Verbosity};
13-
use crate::issues::BadIssueSeeker;
1413
use crate::syntux::parser::{DirectoryOwnership, Parser, ParserError};
1514
use crate::syntux::session::ParseSess;
1615
use crate::utils::count_newlines;
@@ -315,7 +314,6 @@ impl FormattingError {
315314
ErrorKind::LineOverflow(found, max) => (max, found - max),
316315
ErrorKind::TrailingWhitespace
317316
| ErrorKind::DeprecatedAttr
318-
| ErrorKind::BadIssue(_)
319317
| ErrorKind::BadAttr
320318
| ErrorKind::LostComment
321319
| ErrorKind::LicenseCheck => {
@@ -462,11 +460,9 @@ struct FormatLines<'a> {
462460
cur_line: usize,
463461
newline_count: usize,
464462
errors: Vec<FormattingError>,
465-
issue_seeker: BadIssueSeeker,
466463
line_buffer: String,
467464
current_line_contains_string_literal: bool,
468465
format_line: bool,
469-
allow_issue_seek: bool,
470466
config: &'a Config,
471467
}
472468

@@ -476,7 +472,6 @@ impl<'a> FormatLines<'a> {
476472
skipped_range: &'a [(usize, usize)],
477473
config: &'a Config,
478474
) -> FormatLines<'a> {
479-
let issue_seeker = BadIssueSeeker::new(config.report_todo(), config.report_fixme());
480475
FormatLines {
481476
name,
482477
skipped_range,
@@ -485,8 +480,6 @@ impl<'a> FormatLines<'a> {
485480
cur_line: 1,
486481
newline_count: 0,
487482
errors: vec![],
488-
allow_issue_seek: !issue_seeker.is_disabled(),
489-
issue_seeker,
490483
line_buffer: String::with_capacity(config.max_width() * 2),
491484
current_line_contains_string_literal: false,
492485
format_line: config.file_lines().contains_line(name, 1),
@@ -510,28 +503,12 @@ impl<'a> FormatLines<'a> {
510503

511504
// Iterate over the chars in the file map.
512505
fn iterate(&mut self, text: &mut String) {
513-
// List of TODO or FIXME issues on the current line
514-
let mut issues_on_line = Vec::new();
515-
516506
for (kind, c) in CharClasses::new(text.chars()) {
517507
if c == '\r' {
518508
continue;
519509
}
520510

521-
if self.allow_issue_seek && self.format_line {
522-
// Add warnings for bad todos/ fixmes
523-
if let Some(issue) = self.issue_seeker.inspect(c) {
524-
issues_on_line.push(issue);
525-
}
526-
}
527-
528511
if c == '\n' {
529-
// Accumulate TODO or FIXME issues for the rest of the line so the resulting error
530-
// messages contain the entire comment line
531-
for issue in issues_on_line.drain(..) {
532-
self.push_err(ErrorKind::BadIssue(issue), false, false);
533-
}
534-
535512
self.new_line(kind);
536513
} else {
537514
self.char(c, kind);

0 commit comments

Comments
 (0)