Skip to content

Commit

Permalink
Resolve sliced_string_as_bytes clippy lint
Browse files Browse the repository at this point in the history
    warning: calling `as_bytes` after slicing a string
        --> src/lit.rs:1540:21
         |
    1540 |         let mut v = s[2..].as_bytes();
         |                     ^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[2..]`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#sliced_string_as_bytes
         = note: `-W clippy::sliced-string-as-bytes` implied by `-W clippy::all`
         = help: to override `-W clippy::all` add `#[allow(clippy::sliced_string_as_bytes)]`
  • Loading branch information
dtolnay committed Jan 30, 2025
1 parent a09b650 commit 6ebd966
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ mod value {
assert_eq!(byte(s, 1), b'\'');

// We're going to want to have slices which don't respect codepoint boundaries.
let mut v = s[2..].as_bytes();
let mut v = &s.as_bytes()[2..];

let b = match byte(v, 0) {
b'\\' => {
Expand Down

0 comments on commit 6ebd966

Please sign in to comment.