diff options
| author | Philipp Krones <hello@philkrones.com> | 2024-02-22 15:59:29 +0100 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2024-02-22 15:59:29 +0100 |
| commit | dc0bb69e66e72918a72bac38b57bf7716b3e010d (patch) | |
| tree | 05f1aa0df76e5e9ed29455f4aa8b1b23436c8309 /clippy_utils/src/lib.rs | |
| parent | 31b551fee925cf9ca2d3c37fa09a712ef8e66228 (diff) | |
| parent | d554bcad7914a7fbe01a40371a7917ac0b763494 (diff) | |
Merge remote-tracking branch 'upstream/master' into rustup
Diffstat (limited to 'clippy_utils/src/lib.rs')
| -rw-r--r-- | clippy_utils/src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 67a18caca0e..b130322701e 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -14,7 +14,7 @@ clippy::missing_panics_doc, clippy::must_use_candidate, rustc::diagnostic_outside_of_impl, - rustc::untranslatable_diagnostic, + rustc::untranslatable_diagnostic )] // warn on the same lints as `clippy_lints` #![warn(trivial_casts, trivial_numeric_casts)] @@ -1308,8 +1308,8 @@ pub fn contains_return<'tcx>(expr: impl Visitable<'tcx>) -> bool { } /// Gets the parent node, if any. -pub fn get_parent_node(tcx: TyCtxt<'_>, id: HirId) -> Option<Node<'_>> { - Some(tcx.parent_hir_node(id)) +pub fn get_parent_node(tcx: TyCtxt<'_>, id: HirId) -> Node<'_> { + tcx.parent_hir_node(id) } /// Gets the parent expression, if any –- this is useful to constrain a lint. @@ -1321,7 +1321,7 @@ pub fn get_parent_expr<'tcx>(cx: &LateContext<'tcx>, e: &Expr<'_>) -> Option<&'t /// constraint lints pub fn get_parent_expr_for_hir<'tcx>(cx: &LateContext<'tcx>, hir_id: hir::HirId) -> Option<&'tcx Expr<'tcx>> { match get_parent_node(cx.tcx, hir_id) { - Some(Node::Expr(parent)) => Some(parent), + Node::Expr(parent) => Some(parent), _ => None, } } @@ -2182,7 +2182,7 @@ pub fn is_expr_used_or_unified(tcx: TyCtxt<'_>, expr: &Expr<'_>) -> bool { /// Checks if the expression is the final expression returned from a block. pub fn is_expr_final_block_expr(tcx: TyCtxt<'_>, expr: &Expr<'_>) -> bool { - matches!(get_parent_node(tcx, expr.hir_id), Some(Node::Block(..))) + matches!(get_parent_node(tcx, expr.hir_id), Node::Block(..)) } pub fn std_or_core(cx: &LateContext<'_>) -> Option<&'static str> { |
