mirror of
https://github.com/google/comprehensive-rust.git
synced 2026-06-21 00:12:59 +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:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user