File tree 2 files changed +14
-15
lines changed
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:
650
650
651
651
[ RFC 550 ] : https://github.com/rust-lang/rfcs/blob/master/text/0550-macro-future-proofing.md
652
652
653
- ## Procedrual Macros
653
+ ## Procedural Macros
654
654
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
656
656
thing they can be used for is to implement derive on your own types. See
657
657
[ the book] [ procedural macros ] for a tutorial.
658
658
659
659
Procedural macros involve a few different parts of the language and its
660
660
standard 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
662
662
` #[proc_macro_derive(Foo)] ` attribute is used to mark the the deriving
663
663
function. This function must have the type signature:
664
664
@@ -3805,7 +3805,7 @@ impl From<i32> for String {
3805
3805
}
3806
3806
```
3807
3807
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
3809
3809
example:
3810
3810
3811
3811
```
Original file line number Diff line number Diff line change @@ -151,24 +151,23 @@ fn check(cache: &mut Cache,
151
151
}
152
152
let mut parts = url. splitn ( 2 , "#" ) ;
153
153
let url = parts. next ( ) . unwrap ( ) ;
154
- if url. is_empty ( ) {
155
- return
156
- }
157
154
let fragment = parts. next ( ) ;
158
155
let mut parts = url. splitn ( 2 , "?" ) ;
159
156
let url = parts. next ( ) . unwrap ( ) ;
160
157
161
158
// Once we've plucked out the URL, parse it using our base url and
162
159
// then try to extract a file path.
163
160
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
+ }
172
171
}
173
172
}
174
173
You can’t perform that action at this time.
0 commit comments