Closed
Description
The lint expect_fun_call
does not trigger for references. This code should output the warning for both foo
and bar
, but it only outputs it for bar
.
fn foo(x: &Option<[u8; 32]>) -> [u8; 32] {
x.expect(&format!("Call to format: {:?}", x))
}
fn bar(x: Option<[u8; 32]>) -> [u8; 32] {
x.expect(&format!("Call to format: {:?}", x))
}
fn main() {
foo(&Some([0; 32]));
bar(Some([0; 32]));
}
As a fun side-note, this was found by profiling our code and noticing that 50% of it was spent inside a call to format!()
.
Metadata
Metadata
Assignees
Labels
No labels