1 #![warn(clippy::missing_const_for_fn)]
2 #![allow(clippy::let_and_return)]
4 use std::mem::transmute;
12 pub fn new() -> Self {
22 // Could also be const
28 // FIXME: This is a false positive in the `is_min_const_fn` function.
29 // At least until the `const_string_new` feature is stabilzed.
30 fn string() -> String {
35 unsafe fn four() -> i32 {
39 // Could also be const
40 fn generic<T>(t: T) -> T {
44 // FIXME: Depends on the `const_transmute` and `const_fn` feature gates.
45 // In the future Clippy should be able to suggest this as const, too.
46 fn sub(x: u32) -> usize {
47 unsafe { transmute(&x) }
50 // NOTE: This is currently not yet allowed to be const
51 // Once implemented, Clippy should be able to suggest this as const, too.
52 fn generic_arr<T: Copy>(t: [T; 1]) -> T {
64 // This can be const, because `a` is passed by reference
65 pub fn b(self, a: &A) -> B {
71 // Should not be const