Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use binop_separator for + in where bounds #4941

Closed
Iron-E opened this issue Aug 5, 2021 · 2 comments
Closed

Use binop_separator for + in where bounds #4941

Iron-E opened this issue Aug 5, 2021 · 2 comments

Comments

@Iron-E
Copy link

Iron-E commented Aug 5, 2021

The binop_separator option doesn't apply to + signs present in where bounds. For example, when set to "Back", it outputs:

pub async fn retrieve_views<'err, E, L, O, P>() -> DynResult<'err, Vec<EmployeeView>>
where
	E: EmployeeAdapter + Send,
	L: LocationAdapter + Send,
	O: OrganizationAdapter + Send,
	P: PersonAdapter + Send,

	<E as EmployeeAdapter>::Error: 'err
		+ From<<L as LocationAdapter>::Error>
		+ From<<O as OrganizationAdapter>::Error>
		+ From<<P as PersonAdapter>::Error>
		+ Send,
{

Whereas it should output:

pub async fn retrieve_views<'err, E, L, O, P>() -> DynResult<'err, Vec<EmployeeView>>
where
	E: EmployeeAdapter + Send,
	L: LocationAdapter + Send,
	O: OrganizationAdapter + Send,
	P: PersonAdapter + Send,

	<E as EmployeeAdapter>::Error: 'err +
		From<<L as LocationAdapter>::Error> +
		From<<O as OrganizationAdapter>::Error> +
		From<<P as PersonAdapter>::Error> +
		Send,
{
@calebcartwright
Copy link
Member

Thanks for sharing this observation but binop_separator is by design only applicable to binary expressions, and does not apply to compound constraints regardless of the fact that the latter utilizes one of the same symbols.

That needs to continue to be the case, so I'm going to close. If you think the existing documentation for binop_separator is ambiguous or could otherwise be improved to make that more clear please feel free to let me know or submit a PR with suggested changes. If you'd like to have a new config option that could be used to control that behavior in bounds then please open a new issue and we'll take that through the standard process to consider new options.

@Iron-E
Copy link
Author

Iron-E commented Sep 6, 2021

I suppose I saw it having this effect with + and was hoping it would apply here, but I understand the reasoning why you wouldn't want to. I'll open a new issue for creating another option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants