File tree Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -650,15 +650,15 @@ Rust syntax is restricted in two ways:
650650
651651[ RFC 550 ] : https://github.com/rust-lang/rfcs/blob/master/text/0550-macro-future-proofing.md
652652
653- ## Procedrual Macros
653+ ## Procedural Macros
654654
655- "Procedrual macros" are the second way to implement a macro. For now, the only
655+ "Procedural macros" are the second way to implement a macro. For now, the only
656656thing they can be used for is to implement derive on your own types. See
657657[ the book] [ procedural macros ] for a tutorial.
658658
659659Procedural macros involve a few different parts of the language and its
660660standard libraries. First is the ` proc_macro ` crate, included with Rust,
661- that defines an interface for building a procedrual macro. The
661+ that defines an interface for building a procedural macro. The
662662` #[proc_macro_derive(Foo)] ` attribute is used to mark the the deriving
663663function. This function must have the type signature:
664664
@@ -3805,7 +3805,7 @@ impl From<i32> for String {
38053805}
38063806```
38073807
3808- The notation ` Self ` in the impl refers to the implementing type: ` String ` . In another
3808+ The notation ` Self ` in the impl refers to the implementing type: ` String ` . In another
38093809example:
38103810
38113811```
Original file line number Diff line number Diff line change @@ -151,24 +151,23 @@ fn check(cache: &mut Cache,
151151 }
152152 let mut parts = url. splitn ( 2 , "#" ) ;
153153 let url = parts. next ( ) . unwrap ( ) ;
154- if url. is_empty ( ) {
155- return
156- }
157154 let fragment = parts. next ( ) ;
158155 let mut parts = url. splitn ( 2 , "?" ) ;
159156 let url = parts. next ( ) . unwrap ( ) ;
160157
161158 // Once we've plucked out the URL, parse it using our base url and
162159 // then try to extract a file path.
163160 let mut path = file. to_path_buf ( ) ;
164- path. pop ( ) ;
165- for part in Path :: new ( url) . components ( ) {
166- match part {
167- Component :: Prefix ( _) |
168- Component :: RootDir => panic ! ( ) ,
169- Component :: CurDir => { }
170- Component :: ParentDir => { path. pop ( ) ; }
171- Component :: Normal ( s) => { path. push ( s) ; }
161+ if !url. is_empty ( ) {
162+ path. pop ( ) ;
163+ for part in Path :: new ( url) . components ( ) {
164+ match part {
165+ Component :: Prefix ( _) |
166+ Component :: RootDir => panic ! ( ) ,
167+ Component :: CurDir => { }
168+ Component :: ParentDir => { path. pop ( ) ; }
169+ Component :: Normal ( s) => { path. push ( s) ; }
170+ }
172171 }
173172 }
174173
You can’t perform that action at this time.
0 commit comments