Skip to content

Commit f68084a

Browse files
committed
lint: make clippy happy
Replaces `get(0)` with `first()` as suggested by https://rust-lang.github.io/rust-clippy/master/index.html#get_first
1 parent deb379e commit f68084a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,15 @@ pub trait ToSanitizedCase {
232232
impl ToSanitizedCase for str {
233233
fn to_sanitized_pascal_case(&self) -> Cow<str> {
234234
let s = Case::Pascal.sanitize(self);
235-
if s.as_bytes().get(0).unwrap_or(&0).is_ascii_digit() {
235+
if s.as_bytes().first().unwrap_or(&0).is_ascii_digit() {
236236
Cow::from(format!("_{}", s))
237237
} else {
238238
s
239239
}
240240
}
241241
fn to_sanitized_constant_case(&self) -> Cow<str> {
242242
let s = Case::Constant.sanitize(self);
243-
if s.as_bytes().get(0).unwrap_or(&0).is_ascii_digit() {
243+
if s.as_bytes().first().unwrap_or(&0).is_ascii_digit() {
244244
Cow::from(format!("_{}", s))
245245
} else {
246246
s
@@ -250,7 +250,7 @@ impl ToSanitizedCase for str {
250250
const INTERNALS: [&str; 4] = ["set_bit", "clear_bit", "bit", "bits"];
251251

252252
let s = Case::Snake.sanitize(self);
253-
if s.as_bytes().get(0).unwrap_or(&0).is_ascii_digit() {
253+
if s.as_bytes().first().unwrap_or(&0).is_ascii_digit() {
254254
format!("_{}", s).into()
255255
} else if INTERNALS.contains(&s.as_ref()) {
256256
s + "_"

0 commit comments

Comments
 (0)