Satisfy clippy

This commit is contained in:
Kitaiti Makoto 2022-01-27 11:45:35 +09:00
parent 831ef88431
commit 996b161c1e
2 changed files with 2 additions and 3 deletions

View File

@ -304,14 +304,13 @@ impl FromId<DbConn> for Comment {
.chain(bcc) .chain(bcc)
.collect::<HashSet<_>>() // remove duplicates (don't do a query more than once) .collect::<HashSet<_>>() // remove duplicates (don't do a query more than once)
.into_iter() .into_iter()
.map(|v| { .flat_map(|v| {
if let Ok(user) = User::from_id(conn, &v, None, CONFIG.proxy()) { if let Ok(user) = User::from_id(conn, &v, None, CONFIG.proxy()) {
vec![user] vec![user]
} else { } else {
vec![] // TODO try to fetch collection vec![] // TODO try to fetch collection
} }
}) })
.flatten()
.filter(|u| u.get_instance(conn).map(|i| i.local).unwrap_or(false)) .filter(|u| u.get_instance(conn).map(|i| i.local).unwrap_or(false))
.collect::<HashSet<User>>(); //remove duplicates (prevent db error) .collect::<HashSet<User>>(); //remove duplicates (prevent db error)

View File

@ -57,7 +57,7 @@ impl<'a> WhitespaceTokenStream<'a> {
.filter(|&(_, ref c)| c.is_whitespace()) .filter(|&(_, ref c)| c.is_whitespace())
.map(|(offset, _)| offset) .map(|(offset, _)| offset)
.next() .next()
.unwrap_or_else(|| self.text.len()) .unwrap_or(self.text.len())
} }
} }