1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-23 16:12:47 +02:00

closures/exercise.rs: drop trait bounds from struct definition (#2649)

This is more idiomatic than what we had before.

We keep the trait bounds for the inherent impl, because the new method
can use them to guide inference of unannotated closure arguments.
This commit is contained in:
Frances Wingerter 2025-02-20 21:51:39 +00:00 committed by GitHub
parent e16dc70903
commit 63cc474ba0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,11 +29,7 @@ impl Logger for StderrLogger {
// ANCHOR_END: setup
/// Only log messages matching a filtering predicate.
struct Filter<L, P>
where
L: Logger,
P: Fn(u8, &str) -> bool,
{
struct Filter<L, P> {
inner: L,
predicate: P,
}