diff options
| author | flip1995 <philipp.krones@embecosm.com> | 2021-07-09 15:00:24 +0200 |
|---|---|---|
| committer | flip1995 <philipp.krones@embecosm.com> | 2021-07-09 15:00:24 +0200 |
| commit | 5add651223a8d3ba8e2efccf942f9013d2f270a1 (patch) | |
| tree | bfc393e5fa525cb73d1ab7295f6e9d60801f6853 /clippy_utils | |
| parent | 8da39e66accb19d655d8675fc523750dc7ddf207 (diff) | |
| download | rust-5add651223a8d3ba8e2efccf942f9013d2f270a1.tar.gz rust-5add651223a8d3ba8e2efccf942f9013d2f270a1.zip | |
Remove lints_enabled function
This function was redundant with the is_allowed function. Now is_allowed is used everywhere lints_enabled was used before.
Diffstat (limited to 'clippy_utils')
| -rw-r--r-- | clippy_utils/src/lib.rs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 9f09027aadc..121ca2da511 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -1541,25 +1541,6 @@ pub fn fn_def_id(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<DefId> { } } -/// This function checks if any of the lints in the slice is enabled for the provided `HirId`. -/// A lint counts as enabled with any of the levels: `Level::Forbid` | `Level::Deny` | `Level::Warn` -/// -/// ```ignore -/// #[deny(clippy::YOUR_AWESOME_LINT)] -/// println!("Hello, World!"); // <- Clippy code: lints_enabled(cx, &[YOUR_AWESOME_LINT], id) == true -/// -/// #[allow(clippy::YOUR_AWESOME_LINT)] -/// println!("See you soon!"); // <- Clippy code: lints_enabled(cx, &[YOUR_AWESOME_LINT], id) == false -/// ``` -pub fn lints_enabled(cx: &LateContext<'_>, lints: &[&'static Lint], id: HirId) -> bool { - lints.iter().any(|lint| { - matches!( - cx.tcx.lint_level_at_node(lint, id), - (Level::Forbid | Level::Deny | Level::Warn, _) - ) - }) -} - /// Returns Option<String> where String is a textual representation of the type encapsulated in the /// slice iff the given expression is a slice of primitives (as defined in the /// `is_recursively_primitive_type` function) and None otherwise. |
