mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
rustfmt mess
This commit is contained in:
parent
67749b1a30
commit
688d59002e
@ -171,41 +171,39 @@ mod linux {
|
||||
let attr_url = b"url\0".as_ptr() as *const gchar;
|
||||
let schema = schema();
|
||||
match action {
|
||||
cargo_credential::Action::Get(_) => {
|
||||
unsafe {
|
||||
let token_c = secret_password_lookup_sync(
|
||||
&schema,
|
||||
null_mut(),
|
||||
&mut error,
|
||||
attr_url,
|
||||
index_url_c.as_ptr(),
|
||||
null() as *const gchar,
|
||||
);
|
||||
if !error.is_null() {
|
||||
return Err(format!(
|
||||
"failed to get token: {}",
|
||||
CStr::from_ptr((*error).message)
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
)
|
||||
.into());
|
||||
}
|
||||
if token_c.is_null() {
|
||||
return Err(Error::NotFound);
|
||||
}
|
||||
let token = Secret::from(
|
||||
CStr::from_ptr(token_c)
|
||||
cargo_credential::Action::Get(_) => unsafe {
|
||||
let token_c = secret_password_lookup_sync(
|
||||
&schema,
|
||||
null_mut(),
|
||||
&mut error,
|
||||
attr_url,
|
||||
index_url_c.as_ptr(),
|
||||
null() as *const gchar,
|
||||
);
|
||||
if !error.is_null() {
|
||||
return Err(format!(
|
||||
"failed to get token: {}",
|
||||
CStr::from_ptr((*error).message)
|
||||
.to_str()
|
||||
.map_err(|e| format!("expected utf8 token: {}", e))?
|
||||
.to_string(),
|
||||
);
|
||||
Ok(CredentialResponse::Get {
|
||||
token,
|
||||
cache: CacheControl::Session,
|
||||
operation_independent: true,
|
||||
})
|
||||
.unwrap_or_default()
|
||||
)
|
||||
.into());
|
||||
}
|
||||
}
|
||||
if token_c.is_null() {
|
||||
return Err(Error::NotFound);
|
||||
}
|
||||
let token = Secret::from(
|
||||
CStr::from_ptr(token_c)
|
||||
.to_str()
|
||||
.map_err(|e| format!("expected utf8 token: {}", e))?
|
||||
.to_string(),
|
||||
);
|
||||
Ok(CredentialResponse::Get {
|
||||
token,
|
||||
cache: CacheControl::Session,
|
||||
operation_independent: true,
|
||||
})
|
||||
},
|
||||
cargo_credential::Action::Login(options) => {
|
||||
let label = label(registry.name.unwrap_or(registry.index_url));
|
||||
let token = CString::new(read_token(options, registry)?.expose()).unwrap();
|
||||
|
Loading…
x
Reference in New Issue
Block a user