about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-10-20 21:46:42 +0200
committerGitHub <noreply@github.com>2020-10-20 21:46:42 +0200
commit0c2dbb2a1897065cc0ff662fa787ce81a6a82de9 (patch)
tree926b144802d9e21b63204c63bfd0083b0402de82
parentad218f9bb92cbeb9bf21c319d7a04eb47cfdb56e (diff)
parent13f0f49a4eae04178c0f835c3e86865af3ea3088 (diff)
downloadrust-0c2dbb2a1897065cc0ff662fa787ce81a6a82de9.tar.gz
rust-0c2dbb2a1897065cc0ff662fa787ce81a6a82de9.zip
Rollup merge of #78145 - LingMan:ast_pretty_mut, r=jonas-schievink
Drop unneeded `mut`

These parameters don't get modified.

Note that `trailing_comment` is pub and gets exported from `rustc_ast_pretty`. Is that considered to be a stable API? If yes, and you want to reserve the right to modify `self` in `trailing_comment` in the future, that hunk would need to be dropped.
-rw-r--r--compiler/rustc_ast_pretty/src/pp.rs4
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs
index 95f969d7691..56e769ba6b7 100644
--- a/compiler/rustc_ast_pretty/src/pp.rs
+++ b/compiler/rustc_ast_pretty/src/pp.rs
@@ -390,7 +390,7 @@ impl Printer {
         self.scan_stack.pop_front().unwrap()
     }
 
-    fn scan_top(&mut self) -> usize {
+    fn scan_top(&self) -> usize {
         *self.scan_stack.front().unwrap()
     }
 
@@ -484,7 +484,7 @@ impl Printer {
         self.pending_indentation += amount;
     }
 
-    fn get_top(&mut self) -> PrintStackElem {
+    fn get_top(&self) -> PrintStackElem {
         *self.print_stack.last().unwrap_or({
             &PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) }
         })
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs
index af8f8132780..029a6cb664d 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state.rs
@@ -63,7 +63,7 @@ impl<'a> Comments<'a> {
     }
 
     pub fn trailing_comment(
-        &mut self,
+        &self,
         span: rustc_span::Span,
         next_pos: Option<BytePos>,
     ) -> Option<Comment> {