How to suppress “function is never used” warning for a function used by tests?

后端 未结 3 1056
北恋
北恋 2020-12-29 20:33

I\'m writing a program in Rust and I have some tests for it. I wrote a helper function for these tests, but whenever I build using cargo build it warns me that

3条回答
  •  误落风尘
    2020-12-29 21:04

    dead_code is a lint, which means you can allow it on the thing that's causing it to trigger.

    #[allow(dead_code)]
    fn dummy() {}
    
    fn main() {}
    

提交回复
热议问题