mirror of
https://github.com/servo/servo.git
synced 2025-07-30 18:50:36 +01:00
style: Use the ? operator for Option
This commit is contained in:
parent
c52d347022
commit
3005a26daf
13 changed files with 47 additions and 129 deletions
|
@ -145,10 +145,7 @@ fn to_css_identifier(mut camel_case: &str) -> String {
|
|||
|
||||
/// Given "FooBar", returns "Foo" and sets `camel_case` to "Bar".
|
||||
fn split_camel_segment<'input>(camel_case: &mut &'input str) -> Option<&'input str> {
|
||||
let index = match camel_case.chars().next() {
|
||||
None => return None,
|
||||
Some(ch) => ch.len_utf8(),
|
||||
};
|
||||
let index = camel_case.chars().next()?.len_utf8();
|
||||
let end_position = camel_case[index..]
|
||||
.find(char::is_uppercase)
|
||||
.map_or(camel_case.len(), |pos| index + pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue