Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2618,10 +2618,14 @@ fn rewrite_fn_base(
// the closing parenthesis of the param and the arrow '->' is considered.
let mut sig_length = result.len() + indent.width() + ret_str_len + 1;

// If there is no where-clause, take into account the space after the return type
// and the brace.
// Account for the trailing syntax that will be placed on the same line
// after the return type.
if where_clause.predicates.is_empty() {
sig_length += 2;
sig_length += match fn_brace_style {
FnBraceStyle::None => 1, // 1 = `;`
FnBraceStyle::SameLine => 2, // 2 = ` {`
FnBraceStyle::NextLine => 0,
};
}

sig_length > context.config.max_width()
Expand Down
3 changes: 3 additions & 0 deletions tests/source/issue-6539.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub trait Manager {
fn attach_device(&self, seat_id: &str, sysfs_path: &str, interactive: bool) -> zbus::Result<()>;
}
3 changes: 3 additions & 0 deletions tests/target/issue-6539.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub trait Manager {
fn attach_device(&self, seat_id: &str, sysfs_path: &str, interactive: bool) -> zbus::Result<()>;
}
Loading