Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 58188db

Browse files
authored
Merge pull request rust-lang#3015 from YaLTeR/fix-fn-type-comma
Fix extra new line in fn type aliases with indent_style = "Visual"
2 parents 77824a2 + 11435c5 commit 58188db

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ where
400400
shape.block().indent.to_string_with_newline(context.config),
401401
)
402402
};
403-
if last_line_width(&args) + first_line_width(&output) <= shape.width {
403+
if output.is_empty() || last_line_width(&args) + first_line_width(&output) <= shape.width {
404404
Some(format!("{}{}", args, output))
405405
} else {
406406
Some(format!(

tests/source/visual-fn-type.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rustfmt-indent_style: Visual
2+
type CNodeSetAtts = unsafe extern "C" fn(node: *const RsvgNode,
3+
node_impl: *const RsvgCNodeImpl,
4+
handle: *const RsvgHandle,
5+
pbag: *const PropertyBag)
6+
;
7+
type CNodeDraw = unsafe extern "C" fn(node: *const RsvgNode,
8+
node_impl: *const RsvgCNodeImpl,
9+
draw_ctx: *const RsvgDrawingCtx,
10+
dominate: i32);

tests/target/visual-fn-type.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// rustfmt-indent_style: Visual
2+
type CNodeSetAtts = unsafe extern "C" fn(node: *const RsvgNode,
3+
node_impl: *const RsvgCNodeImpl,
4+
handle: *const RsvgHandle,
5+
pbag: *const PropertyBag);
6+
type CNodeDraw = unsafe extern "C" fn(node: *const RsvgNode,
7+
node_impl: *const RsvgCNodeImpl,
8+
draw_ctx: *const RsvgDrawingCtx,
9+
dominate: i32);

0 commit comments

Comments
 (0)