1+ mod utils;
2+
13use rustc_errors:: Applicability ;
24use rustc_hir as hir;
35use rustc_hir:: { BinOpKind , Block , Expr , ExprKind , MatchSource , Node , Stmt , StmtKind } ;
46use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
57use rustc_middle:: lint:: in_external_macro;
6- use rustc_middle:: ty:: { self , Ty } ;
78use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
89use rustc_span:: hygiene:: { ExpnKind , MacroKind } ;
910
@@ -13,6 +14,8 @@ use crate::utils::diagnostics::{span_lint, span_lint_and_then};
1314use crate :: utils:: higher;
1415use crate :: utils:: source:: { indent_of, reindent_multiline, snippet_opt, snippet_with_macro_callsite} ;
1516
17+ use utils:: { is_unit, is_unit_literal} ;
18+
1619declare_clippy_lint ! {
1720 /// **What it does:** Checks for binding a unit value.
1821 ///
@@ -244,14 +247,6 @@ fn is_questionmark_desugar_marked_call(expr: &Expr<'_>) -> bool {
244247 }
245248}
246249
247- fn is_unit ( ty : Ty < ' _ > ) -> bool {
248- matches ! ( ty. kind( ) , ty:: Tuple ( slice) if slice. is_empty( ) )
249- }
250-
251- fn is_unit_literal ( expr : & Expr < ' _ > ) -> bool {
252- matches ! ( expr. kind, ExprKind :: Tup ( ref slice) if slice. is_empty( ) )
253- }
254-
255250fn lint_unit_args ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > , args_to_recover : & [ & Expr < ' _ > ] ) {
256251 let mut applicability = Applicability :: MachineApplicable ;
257252 let ( singular, plural) = if args_to_recover. len ( ) > 1 {
0 commit comments