Among other lints to catch code that might panic. The generated code from mockall currently fails this lint, and it's difficult to add an exception for it with #[allow()] as it's occurring within a proc macro.
This PR updates codegen to replace the instance of index slicing with .get().unwrap(). This does not represent any real change in functionality, just passes the lint check now. It will still panic the same as it would have previously.
I am happy to change this to add a #[allow()] annotation in the generated code if this is preferred. :)
I tend to configure
Cargo.toml
with:https://rust-lang.github.io/rust-clippy/master/index.html#/indexing_slicing
Among other lints to catch code that might panic. The generated code from
mockall
currently fails this lint, and it's difficult to add an exception for it with#[allow()]
as it's occurring within a proc macro.This PR updates codegen to replace the instance of index slicing with
.get().unwrap()
. This does not represent any real change in functionality, just passes the lint check now. It will still panic the same as it would have previously.I am happy to change this to add a
#[allow()]
annotation in the generated code if this is preferred. :)