@@ -61,15 +61,12 @@ mod zst_offset;
6161
6262use bind_instead_of_map:: BindInsteadOfMap ;
6363use clippy_utils:: diagnostics:: { span_lint, span_lint_and_help} ;
64- use clippy_utils:: source:: snippet_with_applicability;
6564use clippy_utils:: ty:: { contains_ty, implements_trait, is_copy, is_type_diagnostic_item} ;
6665use clippy_utils:: {
6766 contains_return, get_trait_def_id, in_macro, iter_input_pats, match_qpath, method_calls, paths, return_ty,
6867 SpanlessEq ,
6968} ;
7069use if_chain:: if_chain;
71- use rustc_ast:: ast;
72- use rustc_errors:: Applicability ;
7370use rustc_hir as hir;
7471use rustc_hir:: { TraitItem , TraitItemKind } ;
7572use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
@@ -1978,34 +1975,6 @@ fn lint_binary_expr_with_method_call(cx: &LateContext<'_>, info: &mut BinaryExpr
19781975 lint_with_both_lhs_and_rhs ! ( chars_last_cmp_with_unwrap:: check, cx, info) ;
19791976}
19801977
1981- fn get_hint_if_single_char_arg (
1982- cx : & LateContext < ' _ > ,
1983- arg : & hir:: Expr < ' _ > ,
1984- applicability : & mut Applicability ,
1985- ) -> Option < String > {
1986- if_chain ! {
1987- if let hir:: ExprKind :: Lit ( lit) = & arg. kind;
1988- if let ast:: LitKind :: Str ( r, style) = lit. node;
1989- let string = r. as_str( ) ;
1990- if string. chars( ) . count( ) == 1 ;
1991- then {
1992- let snip = snippet_with_applicability( cx, arg. span, & string, applicability) ;
1993- let ch = if let ast:: StrStyle :: Raw ( nhash) = style {
1994- let nhash = nhash as usize ;
1995- // for raw string: r##"a"##
1996- & snip[ ( nhash + 2 ) ..( snip. len( ) - 1 - nhash) ]
1997- } else {
1998- // for regular string: "a"
1999- & snip[ 1 ..( snip. len( ) - 1 ) ]
2000- } ;
2001- let hint = format!( "'{}'" , if ch == "'" { "\\ '" } else { ch } ) ;
2002- Some ( hint)
2003- } else {
2004- None
2005- }
2006- }
2007- }
2008-
20091978const FN_HEADER : hir:: FnHeader = hir:: FnHeader {
20101979 unsafety : hir:: Unsafety :: Normal ,
20111980 constness : hir:: Constness :: NotConst ,
0 commit comments