Skip to content

Commit 7a8b355

Browse files
committed
Clean up lint implementation
1 parent a001246 commit 7a8b355

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

clippy_lints/src/danger_not_accepted.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@ use clippy_utils::diagnostics::span_lint_and_then;
44
use clippy_utils::get_attr;
55
use rustc_ast::{ast, token, tokenstream};
66
use rustc_data_structures::fx::{FxHashMap, FxHashSet, StdEntry};
7-
use rustc_hir::*;
7+
use rustc_hir::{def, def_id, Expr, ExprKind, QPath};
88
use rustc_lint::{LateContext, LateLintPass, LintContext};
99
use rustc_session::{declare_tool_lint, impl_lint_pass};
1010
use rustc_span::{Span, Symbol};
1111

12-
// TODO: Safety override
13-
// TODO: Config
12+
// Future improvements:
13+
//
14+
// - Allow users to override modules as *not* having a specific danger.
15+
// - Allow users to specify additional dangerous items in the clippy config.
16+
// - Devise a scheme (maybe path compression?) to reduce the amount of ancestry tracing we have to
17+
// do to determine the dangers posed by a method?
18+
// - Implement a way to forbid `accept_danger` in a given module.
19+
// - Allow `accept_danger` and `dangerous` as internal attributes on stable Rust?
20+
//
1421

1522
declare_clippy_lint! {
1623
/// ### What it does
@@ -84,6 +91,7 @@ pub struct DangerNotAccepted {
8491
impl_lint_pass!(DangerNotAccepted => [DANGER_NOT_ACCEPTED]);
8592

8693
impl LateLintPass<'_> for DangerNotAccepted {
94+
#[allow(clippy::needless_return, reason = "unified syntax improves readability")]
8795
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ Expr<'_>) {
8896
// If we're calling a method...
8997
if let ExprKind::MethodCall(_path, _, _self_arg, ..) = &expr.kind

0 commit comments

Comments
 (0)