@@ -171,41 +171,39 @@ mod linux {
171
171
let attr_url = b"url\0 " . as_ptr ( ) as * const gchar ;
172
172
let schema = schema ( ) ;
173
173
match action {
174
- cargo_credential:: Action :: Get ( _) => {
175
- unsafe {
176
- let token_c = secret_password_lookup_sync (
177
- & schema,
178
- null_mut ( ) ,
179
- & mut error,
180
- attr_url,
181
- index_url_c. as_ptr ( ) ,
182
- null ( ) as * const gchar ,
183
- ) ;
184
- if !error. is_null ( ) {
185
- return Err ( format ! (
186
- "failed to get token: {}" ,
187
- CStr :: from_ptr( ( * error) . message)
188
- . to_str( )
189
- . unwrap_or_default( )
190
- )
191
- . into ( ) ) ;
192
- }
193
- if token_c. is_null ( ) {
194
- return Err ( Error :: NotFound ) ;
195
- }
196
- let token = Secret :: from (
197
- CStr :: from_ptr ( token_c)
174
+ cargo_credential:: Action :: Get ( _) => unsafe {
175
+ let token_c = secret_password_lookup_sync (
176
+ & schema,
177
+ null_mut ( ) ,
178
+ & mut error,
179
+ attr_url,
180
+ index_url_c. as_ptr ( ) ,
181
+ null ( ) as * const gchar ,
182
+ ) ;
183
+ if !error. is_null ( ) {
184
+ return Err ( format ! (
185
+ "failed to get token: {}" ,
186
+ CStr :: from_ptr( ( * error) . message)
198
187
. to_str( )
199
- . map_err ( |e| format ! ( "expected utf8 token: {}" , e) ) ?
200
- . to_string ( ) ,
201
- ) ;
202
- Ok ( CredentialResponse :: Get {
203
- token,
204
- cache : CacheControl :: Session ,
205
- operation_independent : true ,
206
- } )
188
+ . unwrap_or_default( )
189
+ )
190
+ . into ( ) ) ;
207
191
}
208
- }
192
+ if token_c. is_null ( ) {
193
+ return Err ( Error :: NotFound ) ;
194
+ }
195
+ let token = Secret :: from (
196
+ CStr :: from_ptr ( token_c)
197
+ . to_str ( )
198
+ . map_err ( |e| format ! ( "expected utf8 token: {}" , e) ) ?
199
+ . to_string ( ) ,
200
+ ) ;
201
+ Ok ( CredentialResponse :: Get {
202
+ token,
203
+ cache : CacheControl :: Session ,
204
+ operation_independent : true ,
205
+ } )
206
+ } ,
209
207
cargo_credential:: Action :: Login ( options) => {
210
208
let label = label ( registry. name . unwrap_or ( registry. index_url ) ) ;
211
209
let token = CString :: new ( read_token ( options, registry) ?. expose ( ) ) . unwrap ( ) ;
0 commit comments