Skip to content

Commit 48fb113

Browse files
authored
Merge pull request #2100 from topecongiro/issue-2098
Remove redundant shrink_left
2 parents fe39c0c + b0d6d03 commit 48fb113

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

src/items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,13 +1235,13 @@ fn format_tuple_struct(
12351235
}
12361236
result.push(')');
12371237
} else {
1238-
// 3 = `();`
1238+
// 1 = ","
12391239
let body = rewrite_call_inner(
12401240
context,
12411241
"",
12421242
&fields.iter().map(|field| field).collect::<Vec<_>>()[..],
12431243
span,
1244-
Shape::legacy(context.budget(last_line_width(&result) + 3), offset),
1244+
Shape::indented(offset, context.config).sub_width(1)?,
12451245
context.config.fn_call_width(),
12461246
false,
12471247
)?;

src/types.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ pub fn rewrite_path(
6767
result.push_str("::");
6868
}
6969

70-
let extra_offset = extra_offset(&result, shape);
7170
// 3 = ">::".len()
72-
let shape = shape.shrink_left(extra_offset)?.sub_width(3)?;
71+
let shape = shape.sub_width(3)?;
7372

7473
result = rewrite_path_segments(
7574
PathContext::Type,

tests/source/enum.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,8 @@ pub enum Entry<'a, K: 'a, V: 'a> {
141141
pub enum ForegroundColor {
142142
CYAN = (winapi::FOREGROUND_INTENSITY | winapi::FOREGROUND_GREEN | winapi::FOREGROUND_BLUE) as u16,
143143
}
144+
145+
// #2098
146+
pub enum E<'a> {
147+
V ( < std::slice::Iter<'a, Xxxxxxxxxxxxxx> as Iterator> :: Item ) ,
148+
}

tests/target/enum.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,8 @@ pub enum ForegroundColor {
179179
CYAN =
180180
(winapi::FOREGROUND_INTENSITY | winapi::FOREGROUND_GREEN | winapi::FOREGROUND_BLUE) as u16,
181181
}
182+
183+
// #2098
184+
pub enum E<'a> {
185+
V(<std::slice::Iter<'a, Xxxxxxxxxxxxxx> as Iterator>::Item),
186+
}

0 commit comments

Comments
 (0)