Skip to content

Commit cf2f7b4

Browse files
committed
Remove unused imports, variables and functions
1 parent cd9e640 commit cf2f7b4

File tree

11 files changed

+11
-32
lines changed

11 files changed

+11
-32
lines changed

src/closures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use syntax::{ast, ptr};
33

44
use crate::attr::get_attrs_from_stmt;
55
use crate::config::lists::*;
6-
use crate::config::{IndentStyle, SeparatorTactic, Version};
6+
use crate::config::{IndentStyle, SeparatorTactic};
77
use crate::expr::{block_contains_comment, is_simple_block, is_unsafe_block, rewrite_cond};
88
use crate::items::{span_hi_for_param, span_lo_for_param};
99
use crate::lists::{definitive_tactic, itemize_list, write_list, ListFormatting, Separator};

src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::comment::{
1313
rewrite_comment, rewrite_missing_comment, CharClasses, FindUncommented,
1414
};
1515
use crate::config::lists::*;
16-
use crate::config::{Config, ControlBraceStyle, IndentStyle, Version};
16+
use crate::config::{Config, ControlBraceStyle, IndentStyle};
1717
use crate::lists::{
1818
definitive_tactic, itemize_list, shape_for_tactic, struct_lit_formatting, struct_lit_shape,
1919
struct_lit_tactic, write_list, ListFormatting, Separator,

src/items.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::comment::{
1616
FindUncommented,
1717
};
1818
use crate::config::lists::*;
19-
use crate::config::{BraceStyle, Config, IndentStyle, Version};
19+
use crate::config::{BraceStyle, Config, IndentStyle};
2020
use crate::expr::{
2121
is_empty_block, is_simple_block_stmt, rewrite_assign_rhs, rewrite_assign_rhs_expr,
2222
rewrite_assign_rhs_with, RhsTactics,
@@ -2678,20 +2678,6 @@ fn rewrite_generics(
26782678
overflow::rewrite_with_angle_brackets(context, ident, params, shape, generics.span)
26792679
}
26802680

2681-
fn generics_shape_from_config(config: &Config, shape: Shape, offset: usize) -> Option<Shape> {
2682-
match config.indent_style() {
2683-
IndentStyle::Visual => shape.visual_indent(1 + offset).sub_width(offset + 2),
2684-
IndentStyle::Block => {
2685-
// 1 = ","
2686-
shape
2687-
.block()
2688-
.block_indent(config.tab_spaces())
2689-
.with_max_width(config)
2690-
.sub_width(1)
2691-
}
2692-
}
2693-
}
2694-
26952681
fn rewrite_where_clause_rfc_style(
26962682
context: &RewriteContext<'_>,
26972683
where_clause: &ast::WhereClause,

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ fn format_code_block(code_snippet: &str, config: &Config) -> Option<FormattedSni
328328
}
329329
result.push_str(&line);
330330
result.push('\n');
331-
need_indent = indent_next_line(kind, &line, config);
331+
need_indent = indent_next_line(kind);
332332
}
333333
result.push('}');
334334
result
@@ -389,7 +389,7 @@ fn format_code_block(code_snippet: &str, config: &Config) -> Option<FormattedSni
389389
line
390390
};
391391
result.push_str(trimmed_line);
392-
is_indented = indent_next_line(kind, line, config);
392+
is_indented = indent_next_line(kind);
393393
}
394394
Some(FormattedSnippet {
395395
snippet: result,

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ impl MacroBranch {
13901390
{
13911391
s += &indent_str;
13921392
}
1393-
(s + l + "\n", indent_next_line(kind, &l, &config))
1393+
(s + l + "\n", indent_next_line(kind))
13941394
},
13951395
)
13961396
.0;

src/matches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use syntax::{ast, ptr};
77

88
use crate::comment::{combine_strs_with_missing_comments, rewrite_comment};
99
use crate::config::lists::*;
10-
use crate::config::{Config, ControlBraceStyle, IndentStyle, Version};
10+
use crate::config::{Config, ControlBraceStyle, IndentStyle};
1111
use crate::expr::{
1212
format_expr, is_empty_block, is_simple_block, is_unsafe_block, prefer_next_line, rewrite_cond,
1313
ExprType, RhsTactics,

src/overflow.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use syntax::{ast, ptr};
99

1010
use crate::closures;
1111
use crate::config::lists::*;
12-
use crate::config::Version;
1312
use crate::expr::{
1413
can_be_overflowed_expr, is_every_expr_simple, is_method_call, is_nested_call, is_simple_expr,
1514
rewrite_cond,

src/stmt.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use syntax::ast;
22
use syntax_pos::Span;
33

44
use crate::comment::recover_comment_removed;
5-
use crate::config::Version;
65
use crate::expr::{format_expr, ExprType};
76
use crate::rewrite::{Rewrite, RewriteContext};
87
use crate::shape::Shape;

src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use syntax::source_map::{BytePos, Span, DUMMY_SP};
66
use syntax::symbol::kw;
77

88
use crate::config::lists::*;
9-
use crate::config::{IndentStyle, TypeDensity, Version};
9+
use crate::config::{IndentStyle, TypeDensity};
1010
use crate::expr::{format_expr, rewrite_assign_rhs, rewrite_tuple, rewrite_unary_prefix, ExprType};
1111
use crate::lists::{
1212
definitive_tactic, itemize_list, write_list, ListFormatting, ListItem, Separator,

src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use syntax_pos::ExpnId;
1212
use unicode_width::UnicodeWidthStr;
1313

1414
use crate::comment::{filter_normal_code, CharClasses, FullCodeCharKind, LineClasses};
15-
use crate::config::{Config, Version};
15+
use crate::config::Config;
1616
use crate::rewrite::RewriteContext;
1717
use crate::shape::{Indent, Shape};
1818

@@ -617,7 +617,7 @@ pub(crate) fn trim_left_preserve_layout(
617617

618618
/// Based on the given line, determine if the next line can be indented or not.
619619
/// This allows to preserve the indentation of multi-line literals.
620-
pub(crate) fn indent_next_line(kind: FullCodeCharKind, _line: &str, config: &Config) -> bool {
620+
pub(crate) fn indent_next_line(kind: FullCodeCharKind) -> bool {
621621
!(kind.is_string() || kind.is_commented_string())
622622
}
623623

src/visitor.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
238238

239239
let mut last_hi = span.lo();
240240
let mut unindented = false;
241-
let mut prev_ends_with_newline = false;
242-
let mut extra_newline = false;
243241

244242
let skip_normal = |s: &str| {
245243
let trimmed = s.trim();
@@ -270,7 +268,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
270268
let mut comment_on_same_line = !snippet_in_between.contains("\n")
271269
&& !last_line_contains_single_line_comment(&self.buffer);
272270

273-
let mut comment_shape =
271+
let comment_shape =
274272
Shape::indented(self.block_indent, config).comment(config);
275273
if self.config.version() == Version::Two && comment_on_same_line {
276274
self.push_str(" ");
@@ -312,16 +310,13 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
312310
}
313311
}
314312
CodeCharKind::Normal if skip_normal(&sub_slice) => {
315-
extra_newline = prev_ends_with_newline && sub_slice.contains('\n');
316313
continue;
317314
}
318315
CodeCharKind::Normal => {
319316
self.push_str(&self.block_indent.to_string_with_newline(config));
320317
self.push_str(sub_slice.trim());
321318
}
322319
}
323-
prev_ends_with_newline = sub_slice.ends_with('\n');
324-
extra_newline = false;
325320
last_hi = span.lo() + BytePos::from_usize(offset + sub_slice.len());
326321
}
327322
if unindented {

0 commit comments

Comments
 (0)