@@ -13,19 +13,19 @@ pub struct Config {
13
13
#[ derive( Error , Debug ) ]
14
14
pub enum AuthenticationError {
15
15
#[ error( "wrong credentials error" ) ]
16
- WrongCredentialsError ,
16
+ WrongCredentials ,
17
17
#[ error( "no credentials error" ) ]
18
- NoCredentialsError ,
18
+ NoCredentials ,
19
19
#[ error( "request error" ) ]
20
- RequestError ( #[ from] reqwest:: Error ) ,
20
+ Request ( #[ from] reqwest:: Error ) ,
21
21
#[ error( "i/o error" ) ]
22
- IoError ( #[ from] std:: io:: Error ) ,
22
+ Io ( #[ from] std:: io:: Error ) ,
23
23
#[ error( "env error" ) ]
24
- EnvError ( #[ from] env:: VarError ) ,
24
+ Env ( #[ from] env:: VarError ) ,
25
25
#[ error( "missing home dir error" ) ]
26
- MissingHomeDirError ( ) ,
26
+ MissingHomeDir ( ) ,
27
27
#[ error( "invalid header error" ) ]
28
- InvalidHeaderError ( #[ from] InvalidHeaderValue ) ,
28
+ InvalidHeader ( #[ from] InvalidHeaderValue ) ,
29
29
#[ error( "unknown error" ) ]
30
30
Unknown ,
31
31
}
@@ -61,9 +61,9 @@ impl Authentication {
61
61
62
62
match dirs:: home_dir ( ) {
63
63
Some ( path) => {
64
- fs:: read_to_string ( path. join ( ".screenly" ) ) . map_err ( AuthenticationError :: IoError )
64
+ fs:: read_to_string ( path. join ( ".screenly" ) ) . map_err ( AuthenticationError :: Io )
65
65
}
66
- None => Err ( AuthenticationError :: NoCredentialsError ) ,
66
+ None => Err ( AuthenticationError :: NoCredentials ) ,
67
67
}
68
68
}
69
69
@@ -80,7 +80,7 @@ impl Authentication {
80
80
fs:: write ( home. join ( ".screenly" ) , token) ?;
81
81
Ok ( ( ) )
82
82
}
83
- None => Err ( AuthenticationError :: MissingHomeDirError ( ) ) ,
83
+ None => Err ( AuthenticationError :: MissingHomeDir ( ) ) ,
84
84
}
85
85
}
86
86
@@ -96,7 +96,7 @@ impl Authentication {
96
96
. send ( ) ?;
97
97
98
98
match res. status ( ) . as_u16 ( ) {
99
- 401 => Err ( AuthenticationError :: WrongCredentialsError ) ,
99
+ 401 => Err ( AuthenticationError :: WrongCredentials ) ,
100
100
404 => Ok ( ( ) ) ,
101
101
_ => Err ( AuthenticationError :: Unknown ) ,
102
102
}
@@ -115,7 +115,7 @@ impl Authentication {
115
115
reqwest:: blocking:: Client :: builder ( )
116
116
. default_headers ( default_headers)
117
117
. build ( )
118
- . map_err ( AuthenticationError :: RequestError )
118
+ . map_err ( AuthenticationError :: Request )
119
119
}
120
120
}
121
121
@@ -184,7 +184,7 @@ mod tests {
184
184
}
185
185
186
186
#[ test]
187
- fn test_read_token_when_token_is_overriden_with_env_variable_correct_token_is_returned ( ) {
187
+ fn test_read_token_when_token_is_overridden_with_env_variable_correct_token_is_returned ( ) {
188
188
let tmp_dir = TempDir :: new ( "test" ) . unwrap ( ) ;
189
189
let _lock = lock_test ( ) ;
190
190
let _token = set_env ( OsString :: from ( "API_TOKEN" ) , "env_token" ) ;
0 commit comments