Skip to content

Remove report_todo and report_fixme #4129

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

Merged
merged 1 commit into from
Apr 20, 2020
Merged
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
29 changes: 0 additions & 29 deletions Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1888,35 +1888,6 @@ mod sit;
**Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantics
of the original source code.

## `report_fixme`

Report `FIXME` items in comments.

- **Default value**: `"Never"`
- **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
- **Stable**: No (tracking issue: [#3394](https://github.com/rust-lang/rustfmt/issues/3394))

Warns about any comments containing `FIXME` in them when set to `"Always"`. If
it contains a `#X` (with `X` being a number) in parentheses following the
`FIXME`, `"Unnumbered"` will ignore it.

See also [`report_todo`](#report_todo).


## `report_todo`

Report `TODO` items in comments.

- **Default value**: `"Never"`
- **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
- **Stable**: No (tracking issue: [#3393](https://github.com/rust-lang/rustfmt/issues/3393))

Warns about any comments containing `TODO` in them when set to `"Always"`. If
it contains a `#X` (with `X` being a number) in parentheses following the
`TODO`, `"Unnumbered"` will ignore it.

See also [`report_fixme`](#report_fixme).

## `required_version`

Require a specific version of rustfmt. If you want to make sure that the
Expand Down
6 changes: 0 additions & 6 deletions rustfmt-core/rustfmt-lib/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ create_config! {
error_on_unformatted: bool, false, false,
"Error if unable to get comments or string literals within max_width, \
or they are left with trailing whitespaces";
report_todo: ReportTactic, ReportTactic::Never, false,
"Report all, none or unnumbered occurrences of TODO in source file comments";
report_fixme: ReportTactic, ReportTactic::Never, false,
"Report all, none or unnumbered occurrences of FIXME in source file comments";
ignore: IgnoreList, IgnoreList::default(), false,
"Skip formatting the specified files and directories";

Expand Down Expand Up @@ -579,8 +575,6 @@ disable_all_formatting = false
hide_parse_errors = false
error_on_line_overflow = false
error_on_unformatted = false
report_todo = "Never"
report_fixme = "Never"
ignore = []
"#,
env!("CARGO_PKG_VERSION")
Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/rustfmt-lib/src/format_report_formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ fn error_kind_to_snippet_annotation_type(error_kind: &ErrorKind) -> AnnotationTy
| ErrorKind::BadAttr
| ErrorKind::InvalidGlobPattern(_)
| ErrorKind::VersionMismatch => AnnotationType::Error,
ErrorKind::BadIssue(_) | ErrorKind::DeprecatedAttr => AnnotationType::Warning,
ErrorKind::DeprecatedAttr => AnnotationType::Warning,
}
}
23 changes: 0 additions & 23 deletions rustfmt-core/rustfmt-lib/src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use rustc_span::Span;
use self::newline_style::apply_newline_style;
use crate::comment::{CharClasses, FullCodeCharKind};
use crate::config::{Config, FileName, Verbosity};
use crate::issues::BadIssueSeeker;
use crate::syntux::parser::{DirectoryOwnership, Parser, ParserError};
use crate::syntux::session::ParseSess;
use crate::utils::count_newlines;
Expand Down Expand Up @@ -315,7 +314,6 @@ impl FormattingError {
ErrorKind::LineOverflow(found, max) => (max, found - max),
ErrorKind::TrailingWhitespace
| ErrorKind::DeprecatedAttr
| ErrorKind::BadIssue(_)
| ErrorKind::BadAttr
| ErrorKind::LostComment
| ErrorKind::LicenseCheck => {
Expand Down Expand Up @@ -462,11 +460,9 @@ struct FormatLines<'a> {
cur_line: usize,
newline_count: usize,
errors: Vec<FormattingError>,
issue_seeker: BadIssueSeeker,
line_buffer: String,
current_line_contains_string_literal: bool,
format_line: bool,
allow_issue_seek: bool,
config: &'a Config,
}

Expand All @@ -476,7 +472,6 @@ impl<'a> FormatLines<'a> {
skipped_range: &'a [(usize, usize)],
config: &'a Config,
) -> FormatLines<'a> {
let issue_seeker = BadIssueSeeker::new(config.report_todo(), config.report_fixme());
FormatLines {
name,
skipped_range,
Expand All @@ -485,8 +480,6 @@ impl<'a> FormatLines<'a> {
cur_line: 1,
newline_count: 0,
errors: vec![],
allow_issue_seek: !issue_seeker.is_disabled(),
issue_seeker,
line_buffer: String::with_capacity(config.max_width() * 2),
current_line_contains_string_literal: false,
format_line: config.file_lines().contains_line(name, 1),
Expand All @@ -510,28 +503,12 @@ impl<'a> FormatLines<'a> {

// Iterate over the chars in the file map.
fn iterate(&mut self, text: &mut String) {
// List of TODO or FIXME issues on the current line
let mut issues_on_line = Vec::new();

for (kind, c) in CharClasses::new(text.chars()) {
if c == '\r' {
continue;
}

if self.allow_issue_seek && self.format_line {
// Add warnings for bad todos/ fixmes
if let Some(issue) = self.issue_seeker.inspect(c) {
issues_on_line.push(issue);
}
}

if c == '\n' {
// Accumulate TODO or FIXME issues for the rest of the line so the resulting error
// messages contain the entire comment line
for issue in issues_on_line.drain(..) {
self.push_err(ErrorKind::BadIssue(issue), false, false);
}

self.new_line(kind);
} else {
self.char(c, kind);
Expand Down
Loading