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 {
144144 /// assert_eq!(out.protocol(), "https:");
145145 /// ```
146146 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 (
150150 input. as_ptr ( ) . cast ( ) ,
151151 input. len ( ) ,
152152 base. as_ptr ( ) . cast ( ) ,
153153 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 ( ) ) )
166166 }
167167 }
168168
You can’t perform that action at this time.
0 commit comments