Skip to content

Commit aaba01f

Browse files
committed
rename filter to retain
1 parent 8e0f811 commit aaba01f

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

custom_debug_derive/src/filter_ext.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ use synstructure::Structure;
44

55
use syn::Result;
66

7-
pub(crate) trait FilterExt {
7+
pub(crate) trait RetainExt {
88
type Item<'a>;
99

10-
fn filter<F>(&mut self, f: F) -> &mut Self
10+
fn retain<F>(&mut self, f: F) -> &mut Self
1111
where
1212
F: for<'a> FnMut(Self::Item<'a>) -> bool;
1313

14-
fn try_filter<F>(&mut self, mut f: F) -> Result<&mut Self>
14+
fn try_retain<F>(&mut self, mut f: F) -> Result<&mut Self>
1515
where
1616
F: for<'a> FnMut(Self::Item<'a>) -> Result<bool>,
1717
{
1818
let mut filter_err = None;
1919

20-
let result = self.filter(|value| {
20+
let result = self.retain(|value| {
2121
if filter_err.is_some() {
2222
return false;
2323
}
@@ -32,10 +32,10 @@ pub(crate) trait FilterExt {
3232
}
3333
}
3434

35-
impl FilterExt for Structure<'_> {
35+
impl RetainExt for Structure<'_> {
3636
type Item<'a> = &'a BindingInfo<'a>;
3737

38-
fn filter<F>(&mut self, mut f: F) -> &mut Self
38+
fn retain<F>(&mut self, mut f: F) -> &mut Self
3939
where
4040
F: for<'a> FnMut(&'a BindingInfo<'a>) -> bool,
4141
{

custom_debug_derive/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use syn::spanned::Spanned;
55
use syn::{parse_str, Fields, Ident, Lit, Meta, NestedMeta, Path, Result};
66
use synstructure::{decl_derive, AddBounds, BindingInfo, Structure, VariantInfo};
77

8-
use crate::filter_ext::FilterExt;
8+
use crate::filter_ext::RetainExt;
99
use crate::macros::{bail, error};
1010
use crate::result_into_stream_ext::ResultIntoStreamExt;
1111

@@ -39,7 +39,7 @@ fn custom_debug_derive(mut structure: Structure) -> Result<TokenStream> {
3939
fn filter_out_skipped_fields(structure: &mut Structure) -> Result<()> {
4040
let skip_ident: Ident = parse_str("skip").unwrap();
4141

42-
structure.try_filter(|binding| {
42+
structure.try_retain(|binding| {
4343
for meta in get_custom_debug_metas(binding) {
4444
let meta = meta?;
4545

0 commit comments

Comments
 (0)