Skip to content

Commit 01bdcd0

Browse files
SiegeLordExSiegeLord
authored andcommitted
Remove unnecessary config parameter from format_missing_with_indent.
1 parent 05c8c28 commit 01bdcd0

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

src/items.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use syntax::parse::token;
2626

2727
impl<'a> FmtVisitor<'a> {
2828
pub fn visit_let(&mut self, local: &ast::Local, span: Span) {
29-
self.format_missing_with_indent(span.lo, self.config);
29+
self.format_missing_with_indent(span.lo);
3030

3131
// String that is placed within the assignment pattern and expression.
3232
let infix = {
@@ -497,8 +497,7 @@ impl<'a> FmtVisitor<'a> {
497497
}
498498
self.block_indent = self.block_indent.block_unindent(self.config);
499499

500-
self.format_missing_with_indent(span.lo + BytePos(enum_snippet.rfind('}').unwrap() as u32),
501-
self.config);
500+
self.format_missing_with_indent(span.lo + BytePos(enum_snippet.rfind('}').unwrap() as u32));
502501
self.buffer.push_str("}");
503502
}
504503

@@ -508,7 +507,7 @@ impl<'a> FmtVisitor<'a> {
508507
return;
509508
}
510509

511-
self.format_missing_with_indent(field.span.lo, self.config);
510+
self.format_missing_with_indent(field.span.lo);
512511

513512
let result = match field.node.kind {
514513
ast::VariantKind::TupleVariantKind(ref types) => {

src/missed_spans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use config::Config;
1211
use visitor::FmtVisitor;
1312

1413
use syntax::codemap::{self, BytePos};
@@ -20,7 +19,8 @@ impl<'a> FmtVisitor<'a> {
2019
self.format_missing_inner(end, |this, last_snippet, _| this.buffer.push_str(last_snippet))
2120
}
2221

23-
pub fn format_missing_with_indent(&mut self, end: BytePos, config: &Config) {
22+
pub fn format_missing_with_indent(&mut self, end: BytePos) {
23+
let config = self.config;
2424
self.format_missing_inner(end,
2525
|this, last_snippet, snippet| {
2626
this.buffer.push_str(last_snippet.trim_right());

src/visitor.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
5858
}
5959
}
6060
ast::Stmt_::StmtExpr(ref ex, _) | ast::Stmt_::StmtSemi(ref ex, _) => {
61-
self.format_missing_with_indent(stmt.span.lo, self.config);
61+
self.format_missing_with_indent(stmt.span.lo);
6262
let suffix = if let ast::Stmt_::StmtExpr(..) = stmt.node {
6363
""
6464
} else {
@@ -78,7 +78,7 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
7878
}
7979
}
8080
ast::Stmt_::StmtMac(ref _mac, _macro_style) => {
81-
self.format_missing_with_indent(stmt.span.lo, self.config);
81+
self.format_missing_with_indent(stmt.span.lo);
8282
visit::walk_stmt(self, stmt);
8383
}
8484
}
@@ -108,15 +108,15 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
108108

109109
match b.expr {
110110
Some(ref e) => {
111-
self.format_missing_with_indent(e.span.lo, self.config);
111+
self.format_missing_with_indent(e.span.lo);
112112
self.visit_expr(e);
113113
}
114114
None => {}
115115
}
116116

117117
self.block_indent = self.block_indent.block_unindent(self.config);
118118
// TODO: we should compress any newlines here to just one
119-
self.format_missing_with_indent(b.span.hi - brace_compensation, self.config);
119+
self.format_missing_with_indent(b.span.hi - brace_compensation);
120120
self.buffer.push_str("}");
121121
self.last_pos = b.span.hi;
122122
}
@@ -165,7 +165,7 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
165165
};
166166

167167
if let Some(fn_str) = rewrite {
168-
self.format_missing_with_indent(s.lo, self.config);
168+
self.format_missing_with_indent(s.lo);
169169
self.buffer.push_str(&fn_str);
170170
} else {
171171
self.format_missing(b.span.lo);
@@ -200,26 +200,26 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
200200
self.block_indent = self.block_indent.block_unindent(self.config);
201201
}
202202
ast::Item_::ItemExternCrate(_) => {
203-
self.format_missing_with_indent(item.span.lo, self.config);
203+
self.format_missing_with_indent(item.span.lo);
204204
let new_str = self.snippet(item.span);
205205
self.buffer.push_str(&new_str);
206206
self.last_pos = item.span.hi;
207207
}
208208
ast::Item_::ItemStruct(ref def, ref generics) => {
209-
self.format_missing_with_indent(item.span.lo, self.config);
209+
self.format_missing_with_indent(item.span.lo);
210210
self.visit_struct(item.ident, item.vis, def, generics, item.span);
211211
}
212212
ast::Item_::ItemEnum(ref def, ref generics) => {
213-
self.format_missing_with_indent(item.span.lo, self.config);
213+
self.format_missing_with_indent(item.span.lo);
214214
self.visit_enum(item.ident, item.vis, def, generics, item.span);
215215
self.last_pos = item.span.hi;
216216
}
217217
ast::Item_::ItemMod(ref module) => {
218-
self.format_missing_with_indent(item.span.lo, self.config);
218+
self.format_missing_with_indent(item.span.lo);
219219
self.format_mod(module, item.span, item.ident);
220220
}
221221
ast::Item_::ItemMac(..) => {
222-
self.format_missing_with_indent(item.span.lo, self.config);
222+
self.format_missing_with_indent(item.span.lo);
223223
// TODO: we cannot format these yet, because of a bad span.
224224
// See rust lang issue #28424.
225225
// visit::walk_item(self, item);
@@ -236,7 +236,7 @@ impl<'a, 'v> visit::Visitor<'v> for FmtVisitor<'a> {
236236
}
237237

238238
if let ast::TraitItem_::MethodTraitItem(ref sig, None) = ti.node {
239-
self.format_missing_with_indent(ti.span.lo, self.config);
239+
self.format_missing_with_indent(ti.span.lo);
240240

241241
let indent = self.block_indent;
242242
let new_fn = self.rewrite_required_fn(indent, ti.ident, sig, ti.span);
@@ -300,7 +300,7 @@ impl<'a> FmtVisitor<'a> {
300300
}
301301

302302
let first = &attrs[0];
303-
self.format_missing_with_indent(first.span.lo, self.config);
303+
self.format_missing_with_indent(first.span.lo);
304304

305305
if utils::contains_skip(attrs) {
306306
true
@@ -366,12 +366,12 @@ impl<'a> FmtVisitor<'a> {
366366
}
367367
Some(ref s) => {
368368
let s = format!("{}use {};", vis, s);
369-
self.format_missing_with_indent(span.lo, self.config);
369+
self.format_missing_with_indent(span.lo);
370370
self.buffer.push_str(&s);
371371
self.last_pos = span.hi;
372372
}
373373
None => {
374-
self.format_missing_with_indent(span.lo, self.config);
374+
self.format_missing_with_indent(span.lo);
375375
self.format_missing(span.hi);
376376
}
377377
}

0 commit comments

Comments
 (0)