File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
- use lazy_static :: lazy_static ;
1
+ use once_cell :: sync :: Lazy ;
2
2
use regex:: Regex ;
3
3
use std:: env;
4
4
use std:: io;
@@ -136,12 +136,12 @@ struct ProtoUserHostPort<'a> {
136
136
}
137
137
138
138
fn parse_user_host_port ( s : & str ) -> Option < ProtoUserHostPort > {
139
- lazy_static ! {
140
- static ref SSH_REGEX : Regex = Regex :: new(
141
- r"(?x)^((?P<proto>[[:alpha:]]+)://)?((?P<user>.*?)@)?(?P<host>.*?)(:(?P<port>\d+))?$"
139
+ static SSH_REGEX : Lazy < Regex > = Lazy :: new ( || {
140
+ Regex :: new (
141
+ r"(?x)^((?P<proto>[[:alpha:]]+)://)?((?P<user>.*?)@)?(?P<host>.*?)(:(?P<port>\d+))?$" ,
142
142
)
143
- . unwrap( ) ;
144
- }
143
+ . unwrap ( )
144
+ } ) ;
145
145
146
146
SSH_REGEX . captures ( s) . map ( |cap| ProtoUserHostPort {
147
147
proto : cap. name ( "proto" ) . map ( |m| m. as_str ( ) ) ,
You can’t perform that action at this time.
0 commit comments