mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-27 04:50:40 +00:00
Apply suggestions
This commit is contained in:
parent
c6aa9b2e83
commit
36fd13d3b2
@ -473,11 +473,11 @@ impl<S: FastWritable, P: FastWritable> FastWritable for Pluralize<S, P> {
|
||||
/// "b,c,"
|
||||
/// );
|
||||
/// ```
|
||||
pub fn reject<T: PartialEq>(
|
||||
it: impl IntoIterator<Item = T>,
|
||||
filter: T,
|
||||
) -> Result<impl Iterator<Item = T>, Infallible> {
|
||||
Ok(it.into_iter().filter(move |v| v != &filter))
|
||||
pub fn reject<'a, T: PartialEq, U: IntoIterator<Item = T>>(
|
||||
it: U,
|
||||
filter: &'a T,
|
||||
) -> Result<impl Iterator<Item = T> + use<'a, T, U>, Infallible> {
|
||||
Ok(it.into_iter().filter(move |v| v != filter))
|
||||
}
|
||||
|
||||
/// Returns an iterator without filtered out values.
|
||||
@ -505,9 +505,9 @@ pub fn reject<T: PartialEq>(
|
||||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
pub fn reject_with<T: PartialEq, F: Fn(&T) -> bool>(
|
||||
pub fn reject_with<T: PartialEq, F: FnMut(&T) -> bool>(
|
||||
it: impl IntoIterator<Item = T>,
|
||||
callback: F,
|
||||
mut callback: F,
|
||||
) -> Result<impl Iterator<Item = T>, Infallible> {
|
||||
Ok(it.into_iter().filter(move |v| !callback(v)))
|
||||
}
|
||||
|
@ -260,9 +260,12 @@ impl<'a> Generator<'a, '_> {
|
||||
self.visit_arg(ctx, buf, input)?;
|
||||
buf.write(',');
|
||||
if extra_ampersand {
|
||||
buf.write('&');
|
||||
buf.write("&&(");
|
||||
}
|
||||
self.visit_arg(ctx, buf, filter)?;
|
||||
if extra_ampersand {
|
||||
buf.write(')');
|
||||
}
|
||||
buf.write(")?");
|
||||
Ok(DisplayWrap::Wrapped)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user