@@ -199,7 +199,7 @@ mod web_mod {
199199 /// Gets the value of a cookie by name.
200200 pub fn get ( name : & str ) -> Result < Option < String > , CookieError > {
201201 let doc = get_html_document ( ) ;
202- let all = doc. cookie ( ) . map_err ( |e| CookieError :: Get ( e ) ) ?;
202+ let all = doc. cookie ( ) . map_err ( CookieError :: Get ) ?;
203203 for cookie in all. split ( ';' ) {
204204 let cookie = cookie. trim ( ) ;
205205 if let Some ( ( k, v) ) = cookie. split_once ( '=' ) {
@@ -248,19 +248,19 @@ mod web_mod {
248248 let mut parts = vec ! [ format!( "{}={}" , self . name, self . value) ] ;
249249
250250 if let Some ( path) = self . path {
251- parts. push ( format ! ( "Path={}" , path ) ) ;
251+ parts. push ( format ! ( "Path={path}" ) ) ;
252252 }
253253 if let Some ( domain) = self . domain {
254- parts. push ( format ! ( "Domain={}" , domain ) ) ;
254+ parts. push ( format ! ( "Domain={domain}" ) ) ;
255255 }
256256 if let Some ( age) = self . max_age {
257- parts. push ( format ! ( "Max-Age={}" , age ) ) ;
257+ parts. push ( format ! ( "Max-Age={age}" ) ) ;
258258 }
259259 if self . secure {
260260 parts. push ( "Secure" . into ( ) ) ;
261261 }
262262 if let Some ( same) = self . same_site {
263- parts. push ( format ! ( "SameSite={}" , same . to_string ( ) ) ) ;
263+ parts. push ( format ! ( "SameSite={same}" ) ) ;
264264 }
265265
266266 let cookie_str = parts. join ( "; " ) ;
@@ -289,12 +289,12 @@ mod web_mod {
289289 None ,
290290 }
291291
292- impl ToString for SameSite {
293- fn to_string ( & self ) -> String {
292+ impl std :: fmt :: Display for SameSite {
293+ fn fmt ( & self , f : & mut std :: fmt :: Formatter < ' _ > ) -> std :: fmt :: Result {
294294 match self {
295- SameSite :: Strict => "Strict" . into ( ) ,
296- SameSite :: Lax => "Lax" . into ( ) ,
297- SameSite :: None => "None" . into ( ) ,
295+ SameSite :: Strict => f . write_str ( "Strict" ) ,
296+ SameSite :: Lax => f . write_str ( "Lax" ) ,
297+ SameSite :: None => f . write_str ( "None" ) ,
298298 }
299299 }
300300 }
0 commit comments