rrubocop 0.8.14

10x faster RuboCop drop-in. Same output format and configs, without maintaining RuboCop gems.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::io::Write;
use std::path::PathBuf;

use crate::diagnostic::Diagnostic;
use crate::formatter::Formatter;

pub struct FilesFormatter;

impl Formatter for FilesFormatter {
    fn format_to(&self, diagnostics: &[Diagnostic], _files: &[PathBuf], out: &mut dyn Write) {
        let mut seen = std::collections::BTreeSet::new();
        for d in diagnostics {
            if seen.insert(d.path.clone()) {
                let _ = writeln!(out, "{}", d.path);
            }
        }
    }
}