rust-embed icon indicating copy to clipboard operation
rust-embed copied to clipboard

RustEmbed indexing may panic error from clippy

Open stevenj opened this issue 1 year ago • 0 comments

Our project has strict rules on panic, and avoiding behavior which may panic. We are getting the following error when running cargo clippy on a file which uses RustEmbed:

   . error: indexing may panic
   .   --> bin/src/service/docs/mod.rs:29:10
   .    |
   . 29 | #[derive(RustEmbed)]
   .    |          ^^^^^^^^^
   .    |
   .    = help: consider using `.get(n)` or `.get_mut(n)` instead
   .    = help: for further information visit
 https://rust-lang.github.io/rust-clippy/master/index.html#indexing_slicing
   .    = note: requested on the command line with `-D clippy::indexing-slicing`
   .    = note: this error originates in the derive macro `RustEmbed`

stevenj avatar May 10 '24 03:05 stevenj