]> git.lizzy.rs Git - rust.git/blobdiff - src/rustfmt_diff.rs
Update rustc-ap-* crates to 581.0.0 (#3783)
[rust.git] / src / rustfmt_diff.rs
index 8081221af496400b5da736a7af9d11111643d591..fd332b12403625769d9f1147cbc8db326b48344c 100644 (file)
@@ -56,8 +56,8 @@ pub struct ModifiedLines {
 impl From<Vec<Mismatch>> for ModifiedLines {
     fn from(mismatches: Vec<Mismatch>) -> ModifiedLines {
         let chunks = mismatches.into_iter().map(|mismatch| {
-            let lines = || mismatch.lines.iter();
-            let num_removed = lines()
+            let lines = mismatch.lines.iter();
+            let num_removed = lines
                 .filter(|line| match line {
                     DiffLine::Resulting(_) => true,
                     _ => false,
@@ -146,14 +146,14 @@ fn from_str(s: &str) -> Result<ModifiedLines, ()> {
 
 // This struct handles writing output to stdout and abstracts away the logic
 // of printing in color, if it's possible in the executing environment.
-pub struct OutputWriter {
+pub(crate) struct OutputWriter {
     terminal: Option<Box<dyn term::Terminal<Output = io::Stdout>>>,
 }
 
 impl OutputWriter {
     // Create a new OutputWriter instance based on the caller's preference
     // for colorized output and the capabilities of the terminal.
-    pub fn new(color: Color) -> Self {
+    pub(crate) fn new(color: Color) -> Self {
         if let Some(t) = term::stdout() {
             if color.use_colored_tty() && t.supports_color() {
                 return OutputWriter { terminal: Some(t) };
@@ -165,7 +165,7 @@ pub fn new(color: Color) -> Self {
     // Write output in the optionally specified color. The output is written
     // in the specified color if this OutputWriter instance contains a
     // Terminal in its `terminal` field.
-    pub fn writeln(&mut self, msg: &str, color: Option<term::color::Color>) {
+    pub(crate) fn writeln(&mut self, msg: &str, color: Option<term::color::Color>) {
         match &mut self.terminal {
             Some(ref mut t) => {
                 if let Some(color) = color {
@@ -182,7 +182,7 @@ pub fn writeln(&mut self, msg: &str, color: Option<term::color::Color>) {
 }
 
 // Produces a diff between the expected output and actual output of rustfmt.
-pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Mismatch> {
+pub(crate) fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Mismatch> {
     let mut line_number = 1;
     let mut line_number_orig = 1;
     let mut context_queue: VecDeque<&str> = VecDeque::with_capacity(context_size);
@@ -250,7 +250,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
     results
 }
 
-pub fn print_diff<F>(diff: Vec<Mismatch>, get_section_title: F, config: &Config)
+pub(crate) fn print_diff<F>(diff: Vec<Mismatch>, get_section_title: F, config: &Config)
 where
     F: Fn(u32) -> String,
 {