File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -144,25 +144,25 @@ impl Url {
144
144
/// assert_eq!(out.protocol(), "https:");
145
145
/// ```
146
146
pub fn parse ( input : & str , base : Option < & str > ) -> Result < Url , Error > {
147
- unsafe {
148
- let url_aggregator = match base {
149
- Some ( base ) => ada_parse_with_base (
147
+ let url_aggregator = match base {
148
+ Some ( base ) => unsafe {
149
+ ada_parse_with_base (
150
150
input. as_ptr ( ) . cast ( ) ,
151
151
input. len ( ) ,
152
152
base. as_ptr ( ) . cast ( ) ,
153
153
base. len ( ) ,
154
- ) ,
155
- None => ada_parse ( input . as_ptr ( ) . cast ( ) , input . len ( ) ) ,
156
- } ;
157
-
158
- if ffi :: ada_is_valid ( url_aggregator ) {
159
- Ok ( Url {
160
- origin : None ,
161
- url : url_aggregator ,
162
- } )
163
- } else {
164
- Err ( Error :: ParseUrl ( input . to_owned ( ) ) )
165
- }
154
+ )
155
+ } ,
156
+ None => unsafe { ada_parse ( input . as_ptr ( ) . cast ( ) , input . len ( ) ) } ,
157
+ } ;
158
+
159
+ if unsafe { ffi :: ada_is_valid ( url_aggregator ) } {
160
+ Ok ( Url {
161
+ origin : None ,
162
+ url : url_aggregator ,
163
+ } )
164
+ } else {
165
+ Err ( Error :: ParseUrl ( input . to_owned ( ) ) )
166
166
}
167
167
}
168
168
You can’t perform that action at this time.
0 commit comments