Skip to content

Commit

Permalink
Format Rust code using rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Apr 17, 2024
1 parent 9b8fdd9 commit deda08b
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,15 @@ impl<T: AsRef<str>> Capitalize for T {
let mut chars = self.as_ref().chars();
match chars.next() {
None => String::with_capacity(0),
Some(first) => first
.to_uppercase()
.chain(chars)
.collect(),
Some(first) => first.to_uppercase().chain(chars).collect(),
}
}

fn capitalize_last_only(&self) -> String {
let mut chars = self.as_ref().chars()
.rev();
let mut chars = self.as_ref().chars().rev();
match chars.next() {
None => String::with_capacity(0),
Some(last) => last
.to_uppercase()
.chain(chars)
.rev()
.collect()
Some(last) => last.to_uppercase().chain(chars).rev().collect(),
}
}
}
Expand Down

0 comments on commit deda08b

Please sign in to comment.