@@ -12,7 +12,7 @@ use quote::{quote, ToTokens, TokenStreamExt};
1212use std:: { iter, slice} ;
1313use syn:: punctuated:: Punctuated ;
1414use syn:: spanned:: Spanned ;
15- use syn:: token:: { Colon2 , Comma , Eq } ;
15+ use syn:: token:: { Comma , Eq , PathSep } ;
1616use syn:: { parse_quote, Attribute , FnArg , Ident , Item , Token , TraitItem , Type , TypePath } ;
1717
1818/// Autoimpl for types supporting `Deref`
@@ -151,10 +151,7 @@ impl ForDeref {
151151 emit_error ! ( item, "expected trait" ) ;
152152 return TokenStream :: new ( ) ;
153153 }
154- Err ( err) => {
155- emit_error ! ( err) ;
156- return TokenStream :: new ( ) ;
157- }
154+ Err ( err) => return err. into_compile_error ( ) ,
158155 } ;
159156
160157 #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord ) ]
@@ -182,7 +179,7 @@ impl ForDeref {
182179 match item {
183180 TraitItem :: Const ( item) => {
184181 for attr in item. attrs . iter ( ) {
185- if attr. path == parse_quote ! { cfg } {
182+ if * attr. path ( ) == parse_quote ! { cfg } {
186183 attr. to_tokens ( tokens) ;
187184 }
188185 }
@@ -194,14 +191,14 @@ impl ForDeref {
194191
195192 Eq :: default ( ) . to_tokens ( tokens) ;
196193 definitive. to_tokens ( tokens) ;
197- Colon2 :: default ( ) . to_tokens ( tokens) ;
194+ PathSep :: default ( ) . to_tokens ( tokens) ;
198195 item. ident . to_tokens ( tokens) ;
199196
200197 item. semi_token . to_tokens ( tokens) ;
201198 }
202- TraitItem :: Method ( item) => {
199+ TraitItem :: Fn ( item) => {
203200 for attr in item. attrs . iter ( ) {
204- if attr. path == parse_quote ! { cfg } {
201+ if * attr. path ( ) == parse_quote ! { cfg } {
205202 attr. to_tokens ( tokens) ;
206203 }
207204 }
@@ -255,7 +252,7 @@ impl ForDeref {
255252 }
256253 TraitItem :: Type ( item) => {
257254 for attr in item. attrs . iter ( ) {
258- if attr. path == parse_quote ! { cfg } {
255+ if * attr. path ( ) == parse_quote ! { cfg } {
259256 attr. to_tokens ( tokens) ;
260257 }
261258 }
@@ -275,7 +272,7 @@ impl ForDeref {
275272
276273 Eq :: default ( ) . to_tokens ( tokens) ;
277274 definitive. to_tokens ( tokens) ;
278- Colon2 :: default ( ) . to_tokens ( tokens) ;
275+ PathSep :: default ( ) . to_tokens ( tokens) ;
279276 item. ident . to_tokens ( tokens) ;
280277 ty_generics. to_tokens ( tokens) ;
281278
0 commit comments