Skip to content

Commit 219a4da

Browse files
cargo-credential-libsecret: pull out error, attr_url, schema too
1 parent 5b295b7 commit 219a4da

File tree

1 file changed

+3
-9
lines changed
  • credential/cargo-credential-libsecret/src

1 file changed

+3
-9
lines changed

credential/cargo-credential-libsecret/src/lib.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ mod linux {
145145
}
146146

147147
let index_url_c = CString::new(registry.index_url).unwrap();
148+
let mut error: *mut GError = null_mut();
149+
let attr_url = CString::new("url").unwrap();
150+
let schema = schema();
148151
match action {
149152
cargo_credential::Action::Get(_) => {
150-
let mut error: *mut GError = null_mut();
151-
let attr_url = CString::new("url").unwrap();
152-
let schema = schema();
153153
unsafe {
154154
let token_c = secret_password_lookup_sync(
155155
&schema,
@@ -187,9 +187,6 @@ mod linux {
187187
cargo_credential::Action::Login(options) => {
188188
let label = label(registry.name.unwrap_or(registry.index_url));
189189
let token = CString::new(read_token(options, registry)?.expose()).unwrap();
190-
let mut error: *mut GError = null_mut();
191-
let attr_url = CString::new("url").unwrap();
192-
let schema = schema();
193190
unsafe {
194191
secret_password_store_sync(
195192
&schema,
@@ -215,9 +212,6 @@ mod linux {
215212
Ok(CredentialResponse::Login)
216213
}
217214
cargo_credential::Action::Logout => {
218-
let schema = schema();
219-
let mut error: *mut GError = null_mut();
220-
let attr_url = CString::new("url").unwrap();
221215
unsafe {
222216
secret_password_clear_sync(
223217
&schema,

0 commit comments

Comments
 (0)