clippy_lints 0.0.109

A bunch of helpful lints to avoid common pitfalls in Rust
/// **What it does:** Checks for public functions that could be marked `const fn`
///
/// **Why is this bad?** Library users have to duplicate the function just because the `const` keyword is missing
///
/// **Known problems:** A function might not be marked `const`, since it might change in the future to include memoization or similar.
///
/// **Example:**
/// ```rust
/// pub fn random() -> i32 {
///     4 // chosen by fair dice roll.
///       // guaranteed to be random.
/// }
/// ```
declare_lint! {
    pub CONST_FN_CANDIDATE,
    Allow,
    "pub functions that could be marked `const fn`"
}

struct Pass;

impl LintPass for Pass {
    fn get_lints(&self) -> LintArray {
        lint_array![CONST_FN_CANDIDATE]
    }
}

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
}