File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 20
20
#![ cfg_attr( feature = "gazebo_lint" , feature( plugin) ) ]
21
21
#![ cfg_attr( feature = "gazebo_lint" , allow( deprecated) ) ] // :(
22
22
#![ cfg_attr( feature = "gazebo_lint" , plugin( gazebo_lint) ) ]
23
- #![ feature( box_patterns) ]
24
23
25
24
#[ allow( unused_extern_crates) ] // proc_macro is very special
26
25
extern crate proc_macro;
Original file line number Diff line number Diff line change @@ -570,12 +570,15 @@ fn parse_arg(
570
570
571
571
let span = x. span ( ) ;
572
572
match x {
573
- FnArg :: Typed ( PatType {
574
- attrs,
575
- pat : box Pat :: Ident ( ident) ,
576
- ty : box ty,
577
- ..
578
- } ) => {
573
+ FnArg :: Typed ( PatType { attrs, pat, ty, .. } ) => {
574
+ let ident = if let Pat :: Ident ( ident) = * pat {
575
+ ident
576
+ } else {
577
+ return Err ( syn:: Error :: new (
578
+ pat. span ( ) ,
579
+ "Function parameter pattern must be identifier" ,
580
+ ) ) ;
581
+ } ;
579
582
if let Some ( heap) = is_heap ( & ident. ident , & ty) ? {
580
583
if this {
581
584
return Err ( syn:: Error :: new (
@@ -672,15 +675,11 @@ fn parse_arg(
672
675
mutable : ident. mutability . is_some ( ) ,
673
676
name : ident. ident ,
674
677
pass_style,
675
- ty,
678
+ ty : * ty ,
676
679
default : param_attrs. default ,
677
680
source : StarArgSource :: Unknown ,
678
681
} ) )
679
682
}
680
- FnArg :: Typed ( PatType { .. } ) => Err ( syn:: Error :: new (
681
- span,
682
- "Function parameter pattern must be identifier" ,
683
- ) ) ,
684
683
FnArg :: Receiver ( ..) => Err ( syn:: Error :: new (
685
684
span,
686
685
"Function cannot have `self` parameters" ,
You can’t perform that action at this time.
0 commit comments