This repository was archived by the owner on Jul 10, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-21
lines changed Expand file tree Collapse file tree 2 files changed +24
-21
lines changed Original file line number Diff line number Diff line change @@ -70,25 +70,25 @@ pub mod parsing {
70
70
71
71
/** Match an exact color keyword. */
72
72
fn parse_by_name(color : &str) -> Option<Color> {
73
- let col = match color.to_ascii().to_lower().to_str () {
74
- ~" black" => black(),
75
- ~" silver" => silver(),
76
- ~" gray" => gray(),
77
- ~" grey" => gray(),
78
- ~" white" => white(),
79
- ~" maroon" => maroon(),
80
- ~" red" => red(),
81
- ~" purple" => purple(),
82
- ~" fuchsia" => fuchsia(),
83
- ~" green" => green(),
84
- ~" lime" => lime(),
85
- ~" olive" => olive(),
86
- ~" yellow" => yellow(),
87
- ~" navy" => navy(),
88
- ~" blue" => blue(),
89
- ~" teal" => teal(),
90
- ~" aqua" => aqua(),
91
- _ => return fail_unrecognized(color)
73
+ let col = match color.to_ascii().to_lower().to_str_ascii () {
74
+ ~" black" => black(),
75
+ ~" silver" => silver(),
76
+ ~" gray" => gray(),
77
+ ~" grey" => gray(),
78
+ ~" white" => white(),
79
+ ~" maroon" => maroon(),
80
+ ~" red" => red(),
81
+ ~" purple" => purple(),
82
+ ~" fuchsia" => fuchsia(),
83
+ ~" green" => green(),
84
+ ~" lime" => lime(),
85
+ ~" olive" => olive(),
86
+ ~" yellow" => yellow(),
87
+ ~" navy" => navy(),
88
+ ~" blue" => blue(),
89
+ ~" teal" => teal(),
90
+ ~" aqua" => aqua(),
91
+ _ => return fail_unrecognized(color)
92
92
};
93
93
94
94
return Some(col);
@@ -202,6 +202,7 @@ mod test {
202
202
assert!(white().eq(&parse_color(~" white").unwrap()));
203
203
assert!(black().eq(&parse_color(~" Black ").unwrap()));
204
204
assert!(gray().eq(&parse_color(~" Gray ").unwrap()));
205
+ println(" silver");
205
206
assert!(silver().eq(&parse_color(~" SiLvEr ").unwrap()));
206
207
assert!(maroon().eq(&parse_color(~" maroon").unwrap()));
207
208
assert!(purple().eq(&parse_color(~" PURPLE ").unwrap()));
Original file line number Diff line number Diff line change @@ -45,14 +45,16 @@ impl VoidPtrLike for TestNode {
45
45
fn from_void_ptr ( node : * libc:: c_void ) -> TestNode {
46
46
assert ! ( node. is_not_null( ) ) ;
47
47
TestNode ( unsafe {
48
- let box = cast:: reinterpret_cast ( & node) ;
48
+ let box = cast:: transmute_copy ( & node) ;
49
49
cast:: bump_box_refcount ( box) ;
50
50
box
51
51
} )
52
52
}
53
53
54
54
fn to_void_ptr ( & self ) -> * libc:: c_void {
55
- unsafe { cast:: reinterpret_cast ( & ( * self ) ) }
55
+ unsafe {
56
+ cast:: transmute_copy ( & ( * self ) )
57
+ }
56
58
}
57
59
}
58
60
You can’t perform that action at this time.
0 commit comments