@@ -1748,7 +1748,7 @@ fn lint_or_fun_call<'tcx>(
17481748 "try this" ,
17491749 format!(
17501750 "{}.unwrap_or_default()" ,
1751- snippet_with_applicability( cx, self_expr. span, "_ " , & mut applicability)
1751+ snippet_with_applicability( cx, self_expr. span, ".. " , & mut applicability)
17521752 ) ,
17531753 applicability,
17541754 ) ;
@@ -2155,7 +2155,7 @@ fn lint_clone_on_ref_ptr(cx: &LateContext<'_>, expr: &hir::Expr<'_>, arg: &hir::
21552155 return ;
21562156 } ;
21572157
2158- let snippet = snippet_with_macro_callsite ( cx, arg. span , "_ " ) ;
2158+ let snippet = snippet_with_macro_callsite ( cx, arg. span , ".. " ) ;
21592159
21602160 span_lint_and_sugg (
21612161 cx,
@@ -2191,9 +2191,9 @@ fn lint_string_extend(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::E
21912191 "try this" ,
21922192 format ! (
21932193 "{}.push_str({}{})" ,
2194- snippet_with_applicability( cx, args[ 0 ] . span, "_ " , & mut applicability) ,
2194+ snippet_with_applicability( cx, args[ 0 ] . span, ".. " , & mut applicability) ,
21952195 ref_str,
2196- snippet_with_applicability( cx, target. span, "_ " , & mut applicability)
2196+ snippet_with_applicability( cx, target. span, ".. " , & mut applicability)
21972197 ) ,
21982198 applicability,
21992199 ) ;
@@ -2460,7 +2460,7 @@ fn lint_get_unwrap<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, get_args:
24602460 let mut applicability = Applicability :: MachineApplicable ;
24612461 let expr_ty = cx. typeck_results ( ) . expr_ty ( & get_args[ 0 ] ) ;
24622462 let get_args_str = if get_args. len ( ) > 1 {
2463- snippet_with_applicability ( cx, get_args[ 1 ] . span , "_ " , & mut applicability)
2463+ snippet_with_applicability ( cx, get_args[ 1 ] . span , ".. " , & mut applicability)
24642464 } else {
24652465 return ; // not linting on a .get().unwrap() chain or variant
24662466 } ;
@@ -2520,7 +2520,7 @@ fn lint_get_unwrap<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, get_args:
25202520 format ! (
25212521 "{}{}[{}]" ,
25222522 borrow_str,
2523- snippet_with_applicability( cx, get_args[ 0 ] . span, "_ " , & mut applicability) ,
2523+ snippet_with_applicability( cx, get_args[ 0 ] . span, ".. " , & mut applicability) ,
25242524 get_args_str
25252525 ) ,
25262526 applicability,
@@ -2536,7 +2536,7 @@ fn lint_iter_skip_next(cx: &LateContext<'_>, expr: &hir::Expr<'_>, skip_args: &[
25362536 cx,
25372537 ITER_SKIP_NEXT ,
25382538 expr. span . trim_start ( caller. span ) . unwrap ( ) ,
2539- "called `skip(x ).next()` on an iterator" ,
2539+ "called `skip(.. ).next()` on an iterator" ,
25402540 "use `nth` instead" ,
25412541 hint,
25422542 Applicability :: MachineApplicable ,
@@ -2739,11 +2739,11 @@ fn lint_map_unwrap_or_else<'tcx>(
27392739
27402740 // lint message
27412741 let msg = if is_option {
2742- "called `map(f ).unwrap_or_else(g )` on an `Option` value. This can be done more directly by calling \
2743- `map_or_else(g, f )` instead"
2742+ "called `map(<f> ).unwrap_or_else(<g> )` on an `Option` value. This can be done more directly by calling \
2743+ `map_or_else(<g>, <f> )` instead"
27442744 } else {
2745- "called `map(f ).unwrap_or_else(g )` on a `Result` value. This can be done more directly by calling \
2746- `.map_or_else(g, f )` instead"
2745+ "called `map(<f> ).unwrap_or_else(<g> )` on a `Result` value. This can be done more directly by calling \
2746+ `.map_or_else(<g>, <f> )` instead"
27472747 } ;
27482748 // get snippets for args to map() and unwrap_or_else()
27492749 let map_snippet = snippet ( cx, map_args[ 1 ] . span , ".." ) ;
@@ -2809,8 +2809,8 @@ fn lint_map_or_none<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, map
28092809 if is_option {
28102810 let self_snippet = snippet ( cx, map_or_args[ 0 ] . span , ".." ) ;
28112811 let func_snippet = snippet ( cx, map_or_args[ 2 ] . span , ".." ) ;
2812- let msg = "called `map_or(None, f )` on an `Option` value. This can be done more directly by calling \
2813- `and_then(f )` instead";
2812+ let msg = "called `map_or(None, .. )` on an `Option` value. This can be done more directly by calling \
2813+ `and_then(.. )` instead";
28142814 (
28152815 OPTION_MAP_OR_NONE ,
28162816 msg,
@@ -2848,8 +2848,8 @@ fn lint_map_or_none<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, map
28482848fn lint_filter_next < ' tcx > ( cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' _ > , filter_args : & ' tcx [ hir:: Expr < ' _ > ] ) {
28492849 // lint if caller of `.filter().next()` is an Iterator
28502850 if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2851- let msg = "called `filter(p ).next()` on an `Iterator`. This is more succinctly expressed by calling \
2852- `.find(p )` instead.";
2851+ let msg = "called `filter(.. ).next()` on an `Iterator`. This is more succinctly expressed by calling \
2852+ `.find(.. )` instead.";
28532853 let filter_snippet = snippet ( cx, filter_args[ 1 ] . span , ".." ) ;
28542854 if filter_snippet. lines ( ) . count ( ) <= 1 {
28552855 // add note if not multi-line
@@ -2879,9 +2879,9 @@ fn lint_skip_while_next<'tcx>(
28792879 cx,
28802880 SKIP_WHILE_NEXT ,
28812881 expr. span ,
2882- "called `skip_while(p ).next()` on an `Iterator`" ,
2882+ "called `skip_while(<p> ).next()` on an `Iterator`" ,
28832883 None ,
2884- "this is more succinctly expressed by calling `.find(!p )` instead" ,
2884+ "this is more succinctly expressed by calling `.find(!<p> )` instead" ,
28852885 ) ;
28862886 }
28872887}
@@ -2895,7 +2895,7 @@ fn lint_filter_map<'tcx>(
28952895) {
28962896 // lint if caller of `.filter().map()` is an Iterator
28972897 if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2898- let msg = "called `filter(p ).map(q )` on an `Iterator`" ;
2898+ let msg = "called `filter(.. ).map(.. )` on an `Iterator`" ;
28992899 let hint = "this is more succinctly expressed by calling `.filter_map(..)` instead" ;
29002900 span_lint_and_help ( cx, FILTER_MAP , expr. span , msg, None , hint) ;
29012901 }
@@ -2904,8 +2904,8 @@ fn lint_filter_map<'tcx>(
29042904/// lint use of `filter_map().next()` for `Iterators`
29052905fn lint_filter_map_next < ' tcx > ( cx : & LateContext < ' tcx > , expr : & ' tcx hir:: Expr < ' _ > , filter_args : & ' tcx [ hir:: Expr < ' _ > ] ) {
29062906 if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2907- let msg = "called `filter_map(p ).next()` on an `Iterator`. This is more succinctly expressed by calling \
2908- `.find_map(p )` instead.";
2907+ let msg = "called `filter_map(.. ).next()` on an `Iterator`. This is more succinctly expressed by calling \
2908+ `.find_map(.. )` instead.";
29092909 let filter_snippet = snippet ( cx, filter_args[ 1 ] . span , ".." ) ;
29102910 if filter_snippet. lines ( ) . count ( ) <= 1 {
29112911 span_lint_and_note (
@@ -2931,7 +2931,7 @@ fn lint_find_map<'tcx>(
29312931) {
29322932 // lint if caller of `.filter().map()` is an Iterator
29332933 if match_trait_method ( cx, & map_args[ 0 ] , & paths:: ITERATOR ) {
2934- let msg = "called `find(p ).map(q )` on an `Iterator`" ;
2934+ let msg = "called `find(.. ).map(.. )` on an `Iterator`" ;
29352935 let hint = "this is more succinctly expressed by calling `.find_map(..)` instead" ;
29362936 span_lint_and_help ( cx, FIND_MAP , expr. span , msg, None , hint) ;
29372937 }
@@ -2946,7 +2946,7 @@ fn lint_filter_map_map<'tcx>(
29462946) {
29472947 // lint if caller of `.filter().map()` is an Iterator
29482948 if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2949- let msg = "called `filter_map(p ).map(q )` on an `Iterator`" ;
2949+ let msg = "called `filter_map(.. ).map(.. )` on an `Iterator`" ;
29502950 let hint = "this is more succinctly expressed by only calling `.filter_map(..)` instead" ;
29512951 span_lint_and_help ( cx, FILTER_MAP , expr. span , msg, None , hint) ;
29522952 }
@@ -2961,7 +2961,7 @@ fn lint_filter_flat_map<'tcx>(
29612961) {
29622962 // lint if caller of `.filter().flat_map()` is an Iterator
29632963 if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2964- let msg = "called `filter(p ).flat_map(q )` on an `Iterator`" ;
2964+ let msg = "called `filter(.. ).flat_map(.. )` on an `Iterator`" ;
29652965 let hint = "this is more succinctly expressed by calling `.flat_map(..)` \
29662966 and filtering by returning `iter::empty()`";
29672967 span_lint_and_help ( cx, FILTER_MAP , expr. span , msg, None , hint) ;
@@ -2977,7 +2977,7 @@ fn lint_filter_map_flat_map<'tcx>(
29772977) {
29782978 // lint if caller of `.filter_map().flat_map()` is an Iterator
29792979 if match_trait_method ( cx, expr, & paths:: ITERATOR ) {
2980- let msg = "called `filter_map(p ).flat_map(q )` on an `Iterator`" ;
2980+ let msg = "called `filter_map(.. ).flat_map(.. )` on an `Iterator`" ;
29812981 let hint = "this is more succinctly expressed by calling `.flat_map(..)` \
29822982 and filtering by returning `iter::empty()`";
29832983 span_lint_and_help ( cx, FILTER_MAP , expr. span , msg, None , hint) ;
@@ -3148,9 +3148,9 @@ fn lint_chars_cmp(
31483148 "like this" ,
31493149 format!( "{}{}.{}({})" ,
31503150 if info. eq { "" } else { "!" } ,
3151- snippet_with_applicability( cx, args[ 0 ] [ 0 ] . span, "_ " , & mut applicability) ,
3151+ snippet_with_applicability( cx, args[ 0 ] [ 0 ] . span, ".. " , & mut applicability) ,
31523152 suggest,
3153- snippet_with_applicability( cx, arg_char[ 0 ] . span, "_ " , & mut applicability) ) ,
3153+ snippet_with_applicability( cx, arg_char[ 0 ] . span, ".. " , & mut applicability) ) ,
31543154 applicability,
31553155 ) ;
31563156
@@ -3197,7 +3197,7 @@ fn lint_chars_cmp_with_unwrap<'tcx>(
31973197 "like this" ,
31983198 format!( "{}{}.{}('{}')" ,
31993199 if info. eq { "" } else { "!" } ,
3200- snippet_with_applicability( cx, args[ 0 ] [ 0 ] . span, "_ " , & mut applicability) ,
3200+ snippet_with_applicability( cx, args[ 0 ] [ 0 ] . span, ".. " , & mut applicability) ,
32013201 suggest,
32023202 c) ,
32033203 applicability,
@@ -3272,7 +3272,7 @@ fn lint_single_char_pattern(cx: &LateContext<'_>, _expr: &hir::Expr<'_>, arg: &h
32723272fn lint_single_char_push_string ( cx : & LateContext < ' _ > , expr : & hir:: Expr < ' _ > , args : & [ hir:: Expr < ' _ > ] ) {
32733273 let mut applicability = Applicability :: MachineApplicable ;
32743274 if let Some ( extension_string) = get_hint_if_single_char_arg ( cx, & args[ 1 ] , & mut applicability) {
3275- let base_string_snippet = snippet_with_applicability ( cx, args[ 0 ] . span , "_ " , & mut applicability) ;
3275+ let base_string_snippet = snippet_with_applicability ( cx, args[ 0 ] . span , ".. " , & mut applicability) ;
32763276 let sugg = format ! ( "{}.push({})" , base_string_snippet, extension_string) ;
32773277 span_lint_and_sugg (
32783278 cx,
@@ -3315,7 +3315,7 @@ fn lint_asref(cx: &LateContext<'_>, expr: &hir::Expr<'_>, call_name: &str, as_re
33153315 expr. span ,
33163316 & format ! ( "this call to `{}` does nothing" , call_name) ,
33173317 "try this" ,
3318- snippet_with_applicability ( cx, recvr. span , "_ " , & mut applicability) . to_string ( ) ,
3318+ snippet_with_applicability ( cx, recvr. span , ".. " , & mut applicability) . to_string ( ) ,
33193319 applicability,
33203320 ) ;
33213321 }
0 commit comments