Skip to content

Commit ef3def5

Browse files
authored
Remove coverage mode (#4015)
1 parent a9d7cd5 commit ef3def5

File tree

11 files changed

+2
-58
lines changed

11 files changed

+2
-58
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ needs to be specified in `rustfmt.toml`, e.g., with `edition = "2018"`.
218218
| :--------: | :-----------------------------------------------: | :----------: |
219219
| files | overwrites output to files | No |
220220
| stdout | writes output to stdout | No |
221-
| coverage | displays how much of the input file was processed | Yes |
222221
| checkstyle | emits in a checkstyle format | Yes |
223222
| json | emits diffs in a json format | Yes |
224223

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ pub enum EmitMode {
115115
Files,
116116
/// Writes the output to stdout.
117117
Stdout,
118-
/// Displays how much of the input file was processed
119-
Coverage,
120118
/// Unfancy stdout
121119
Checkstyle,
122120
/// Writes the resulting diffs in a JSON format. Returns an empty array

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

Lines changed: 0 additions & 15 deletions
This file was deleted.

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ mod attr;
4646
mod chains;
4747
mod closures;
4848
mod comment;
49-
mod coverage;
5049
mod expr;
5150
mod format_report_formatter;
5251
pub(crate) mod formatting;
@@ -473,9 +472,7 @@ pub(crate) fn create_emitter<'a>(config: &Config) -> Box<dyn Emitter + 'a> {
473472
EmitMode::Files => Box::new(emitter::FilesEmitter::new(
474473
config.print_misformatted_file_names(),
475474
)),
476-
EmitMode::Stdout | EmitMode::Coverage => {
477-
Box::new(emitter::StdoutEmitter::new(config.verbose()))
478-
}
475+
EmitMode::Stdout => Box::new(emitter::StdoutEmitter::new(config.verbose())),
479476
EmitMode::Json => Box::new(emitter::JsonEmitter::default()),
480477
EmitMode::ModifiedLines => Box::new(emitter::ModifiedLinesEmitter::default()),
481478
EmitMode::Checkstyle => Box::new(emitter::CheckstyleEmitter::default()),

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use rustc_span::{BytePos, Pos, Span};
33
use crate::comment::{is_last_comment_block, rewrite_comment, CodeCharKind, CommentCodeSlices};
44
use crate::config::file_lines::FileLines;
55
use crate::config::FileName;
6-
use crate::coverage::transform_missing_snippet;
76
use crate::shape::{Indent, Shape};
87
use crate::source_map::LineRangeUtils;
98
use crate::utils::{
@@ -155,7 +154,7 @@ impl<'a> FmtVisitor<'a> {
155154
fn write_snippet_inner<F>(
156155
&mut self,
157156
big_snippet: &str,
158-
old_snippet: &str,
157+
snippet: &str,
159158
big_diff: usize,
160159
span: Span,
161160
process_last_snippet: F,
@@ -169,8 +168,6 @@ impl<'a> FmtVisitor<'a> {
169168
let file_name = &self.parse_sess.span_to_filename(span);
170169
let mut status = SnippetStatus::new(line);
171170

172-
let snippet = &*transform_missing_snippet(self.config, old_snippet);
173-
174171
let slice_within_file_lines_range =
175172
|file_lines: FileLines, cur_line, s| -> (usize, usize, bool) {
176173
let (lf_count, crlf_count) = count_lf_crlf(s);

rustfmt-core/rustfmt-lib/src/test/mod.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,22 +193,6 @@ fn system_tests() {
193193
});
194194
}
195195

196-
// Do the same for tests/coverage-source directory.
197-
// The only difference is the coverage mode.
198-
#[test]
199-
fn coverage_tests() {
200-
init_log();
201-
let files = get_test_files(
202-
Path::new("tests/coverage/source"),
203-
true,
204-
SKIP_FILE_WHITE_LIST,
205-
);
206-
let (_reports, count, fails) = check_files(files, &None);
207-
208-
println!("Ran {} tests in coverage mode.", count);
209-
assert_eq!(fails, 0, "{} tests failed", fails);
210-
}
211-
212196
#[test]
213197
fn checkstyle_test() {
214198
init_log();

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_span::{BytePos, Pos, Span};
77
use crate::attr::*;
88
use crate::comment::{rewrite_comment, CodeCharKind, CommentCodeSlices};
99
use crate::config::{BraceStyle, Config};
10-
use crate::coverage::transform_missing_snippet;
1110
use crate::items::{
1211
format_impl, format_trait, format_trait_alias, is_mod_decl, is_use_item,
1312
rewrite_associated_impl_type, rewrite_associated_type, rewrite_extern_crate,
@@ -268,7 +267,6 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
268267
)
269268
.peekable();
270269
while let Some((kind, offset, sub_slice)) = iter.next() {
271-
let sub_slice = transform_missing_snippet(config, sub_slice);
272270
debug!("close_block: {:?} {:?} {:?}", kind, offset, sub_slice);
273271

274272
match kind {

rustfmt-core/rustfmt-lib/tests/coverage/source/comments.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

rustfmt-core/rustfmt-lib/tests/coverage/target/comments.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)