Skip to content

Commit

Permalink
Incorporate clippy suggestion
Browse files Browse the repository at this point in the history
Incorporate a suggestion that clippy in Rust 1.81 makes about using a
character array in a String::replace call.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o authored and danielocfb committed Sep 6, 2024
1 parent 5a64498 commit a115f10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libbpf-cargo/src/gen/btf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ fn escape_reserved_keyword(identifier: Cow<'_, str>) -> Cow<'_, str> {
if disallowed_raw.binary_search(&identifier.as_ref()).is_ok() {
// Just remove the first 'a' or 'e' character. Yes, that could
// conceivably be the cause of a collision in itself ¯\_(ツ)_/¯
Cow::Owned(identifier.replacen(|chr| chr == 'a' || chr == 'e', "", 1))
Cow::Owned(identifier.replacen(['a', 'e'], "", 1))
} else {
Cow::Owned(format!("r#{identifier}"))
}
Expand Down

0 comments on commit a115f10

Please sign in to comment.