diff options
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> { |
