File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -574,19 +574,15 @@ impl Window {
574574 }
575575 fn try_update_domain_color ( & self ) -> anyhow:: Result < ( ) > {
576576 let imp = self . imp ( ) ;
577- let url = imp. url . borrow ( ) ;
578- let url = if let Ok ( domain) = Url :: parse ( & url) {
579- if let Some ( domain) = domain. domain ( ) {
580- domain. to_string ( )
581- } else {
582- url. to_string ( )
583- }
584- } else {
585- url. to_string ( )
577+ let color_source = {
578+ let url = imp. url . borrow ( ) ;
579+ let parsed_url = Url :: parse ( & url) ;
580+ let domain = parsed_url. as_ref ( ) . map ( |u| u. domain ( ) ) . ok ( ) . flatten ( ) ;
581+ domain. unwrap_or ( & url) . to_string ( )
586582 } ;
587583 let hash = {
588584 let mut s = std:: collections:: hash_map:: DefaultHasher :: new ( ) ;
589- url . hash ( & mut s) ;
585+ color_source . hash ( & mut s) ;
590586 s. finish ( )
591587 } ;
592588 let hue = hash % 360 ;
You can’t perform that action at this time.
0 commit comments