Skip to content

Commit

Permalink
Merge branch 'remove-joinery-dependency'
Browse files Browse the repository at this point in the history
  • Loading branch information
wezm committed Mar 31, 2024
2 parents 13a4888 + 60b14ff commit 056446a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ categories = ["text-processing"]

[dependencies]
regex = "1.5"
joinery = "< 3.0" # 3.0+ requires 2021 edition, which our MSRV does not support
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use std::borrow::Cow;
use std::sync::OnceLock;

use joinery::JoinableIterator;
use regex::{Captures, Regex};

#[rustfmt::skip]
Expand Down Expand Up @@ -128,7 +127,13 @@ fn process_word(word: &str) -> Cow<'_, str> {
let rest = titlecase(&word[1..]);
Cow::from(format!("({}", rest))
} else if has_internal_slashes(word) {
Cow::from(word.split('/').map(titlecase).join_with('/').to_string())
Cow::from(
word.split('/')
.map(titlecase)
// TODO: Awaiting rust iter.intersperse('/');
.collect::<Vec<String>>()
.join("/"),
)
} else if has_internal_caps(word) {
// Preserve internal caps like iPhone or DuBois
Cow::from(word)
Expand Down

0 comments on commit 056446a

Please sign in to comment.