summaryrefslogtreecommitdiffstats
path: root/categories
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2019-08-03 19:39:11 +0100
committerKornel <kornel@geekhood.net>2019-08-03 20:01:44 +0100
commit4fed0b350b781863e0e0e7c4bee7e407d2c1e12e (patch)
tree3cfccf0745d2f3d45a2ec75914d1195e43e02086 /categories
parent42a5a9051c81527441b2c7b6077a19a6b64d7916 (diff)
Move category fudge to reading stage
Diffstat (limited to 'categories')
-rw-r--r--categories/src/categories.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/categories/src/categories.rs b/categories/src/categories.rs
index ebb3c2c..7840457 100644
--- a/categories/src/categories.rs
+++ b/categories/src/categories.rs
@@ -110,8 +110,8 @@ impl Categories {
}).collect()
}
- pub fn fixed_category_slugs(cats: &[String]) -> Vec<Cow<'_, str>> {
- let mut cats = cats.iter().enumerate().filter_map(|(idx, s)| {
+ pub fn filtered_category_slugs(cats: &[String]) -> impl Iterator<Item=&str> {
+ cats.iter().filter_map(|s| {
if s.len() < 2 {
return None;
}
@@ -121,6 +121,12 @@ impl Categories {
if s == "api-bindings" { // We pretend it doesn't exist
return None;
}
+ Some(s.as_str())
+ })
+ }
+
+ pub fn fixed_category_slugs(cats: &[String]) -> Vec<Cow<'_, str>> {
+ let mut cats = Self::filtered_category_slugs(cats).enumerate().filter_map(|(idx, s)| {
let mut chars = s.chars().peekable();
while let Some(cur) = chars.next() {
// look for a:b instead of a::b