1 //! False-positive tests to ensure we don't suggest `const` for things where it would cause a
3 //! The .stderr output of this test should be empty. Otherwise it's a bug somewhere.
5 #![warn(clippy::missing_const_for_fn)]
10 // This should not be linted because it's already const
11 const fn already_const() -> i32 {
16 // This should not be linted because it's already const
17 pub const fn already_const() -> i32 {
22 // Allowing on this function, because it would lint, which we don't want in this case.
23 #[allow(clippy::missing_const_for_fn)]
28 // We should not suggest to make this function `const` because `random()` is non-const
29 fn random_caller() -> u32 {
35 // We should not suggest to make this function `const` because const functions are not allowed to
36 // refer to a static variable
42 // Don't lint entrypoint functions
44 fn init(num: isize, something: *const *const u8) -> isize {
49 // This should not be suggested to be made const
50 // (rustc doesn't allow const trait methods)
53 // This should not be suggested to be made const either