Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've marked this PR as DRAFT because I need these changes for something I'm testing but I don't actually know if they are needed, or correct, at this point.
Remove defaults from trait generic type parameters (i.e. TraitName<TypeParameter = ...>) to prevent intermediate types that impl the trait from not themselves allowing the default type parameter to be overridden.
Move common bounds up from implementers of the Service trait to the Service trait itself. This both reduces boilerplate and reduces the chances of a type having stricter bounds on the struct and fns (such as fn new()) than its Service trait impl, making it hard to find the cause of a bounds mismatch.
Align bounds on all middleware struct blocks to match the bounds on the Service trait impls to catch mismatched bounds earlier.
Remove unnecessary ?Sized bound on impl Service for U where U: Deref.