Skip to content

Commit 71b92e8

Browse files
committed
rustfmt: move where clauses
1 parent baa8540 commit 71b92e8

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

src/api.rs

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ impl Keyring {
107107
/// Requests a keyring with the given description by searching the thread, process, and session
108108
/// keyrings.
109109
pub fn request<D>(description: D) -> Result<Self>
110-
where D: AsRef<str>,
110+
where
111+
D: AsRef<str>,
111112
{
112113
Keyring::new_impl(0).request_keyring(description)
113114
}
@@ -118,8 +119,9 @@ impl Keyring {
118119
/// If it is not found, the `info` string will be handed off to `/sbin/request-key` to generate
119120
/// the key.
120121
pub fn request_with_fallback<D, I>(description: D, info: I) -> Result<Self>
121-
where D: AsRef<str>,
122-
I: AsRef<str>,
122+
where
123+
D: AsRef<str>,
124+
I: AsRef<str>,
123125
{
124126
Keyring::new_impl(0).request_keyring_with_fallback(description, info)
125127
}
@@ -150,7 +152,8 @@ impl Keyring {
150152
/// If a keyring named `name` exists, attach it as the session keyring (requires the `search`
151153
/// permission). If a keyring does not exist, create it and attach it as the session keyring.
152154
pub fn join_session<N>(name: N) -> Result<Self>
153-
where N: AsRef<str>,
155+
where
156+
N: AsRef<str>,
154157
{
155158
let name_cstr = CString::new(name.as_ref()).unwrap();
156159
let res = unsafe { keyctl_join_session_keyring(name_cstr.as_ptr()) };
@@ -208,7 +211,8 @@ impl Keyring {
208211
/// `link` permission on the key exist) and return it. Requires the `search` permission on the
209212
/// keyring. Any children keyrings without the `search` permission are ignored.
210213
pub fn search_for_key<D>(&self, description: D) -> Result<Key>
211-
where D: AsRef<str>,
214+
where
215+
D: AsRef<str>,
212216
{
213217
let res = self.search_impl("user", description.as_ref())?;
214218
check_call(res, Key::new_impl(res as key_serial_t))
@@ -221,7 +225,8 @@ impl Keyring {
221225
/// permission on the keyring. Any children keyrings without the `search` permission are
222226
/// ignored.
223227
pub fn search_for_keyring<D>(&self, description: D) -> Result<Self>
224-
where D: AsRef<str>,
228+
where
229+
D: AsRef<str>,
225230
{
226231
let res = self.search_impl("keyring", description.as_ref())?;
227232
check_call(res, Keyring::new_impl(res as key_serial_t))
@@ -294,7 +299,8 @@ impl Keyring {
294299
/// If a keyring with the same description already, the link to the old keyring will be
295300
/// removed. Requires `write` permission on the keyring.
296301
pub fn add_keyring<D>(&mut self, description: D) -> Result<Self>
297-
where D: Borrow<<keytypes::Keyring as KeyType>::Description>,
302+
where
303+
D: Borrow<<keytypes::Keyring as KeyType>::Description>,
298304
{
299305
let key = self.add_key::<keytypes::Keyring, _, _>(description, ())?;
300306
Ok(Keyring::new_impl(key.id))
@@ -313,7 +319,8 @@ impl Keyring {
313319
///
314320
/// If it is found, it is attached to the keyring.
315321
pub fn request_key<D>(&self, description: D) -> Result<Key>
316-
where D: AsRef<str>,
322+
where
323+
D: AsRef<str>,
317324
{
318325
let res = self.request_impl("user", description.as_ref())?;
319326
check_call(i64::from(res), Key::new_impl(res))
@@ -324,7 +331,8 @@ impl Keyring {
324331
///
325332
/// If it is found, it is attached to the keyring.
326333
pub fn request_keyring<D>(&self, description: D) -> Result<Self>
327-
where D: AsRef<str>,
334+
where
335+
D: AsRef<str>,
328336
{
329337
let res = self.request_impl("keyring", description.as_ref())?;
330338
check_call(i64::from(res), Keyring::new_impl(res))
@@ -349,8 +357,9 @@ impl Keyring {
349357
/// the key. If found, it will be attached to the current keyring. Requires `write` permission
350358
/// to the keyring.
351359
pub fn request_key_with_fallback<D, I>(&self, description: D, info: I) -> Result<Key>
352-
where D: AsRef<str>,
353-
I: AsRef<str>,
360+
where
361+
D: AsRef<str>,
362+
I: AsRef<str>,
354363
{
355364
let res = self.request_fallback_impl("user", description.as_ref(), info.as_ref())?;
356365
check_call(i64::from(res), Key::new_impl(res))
@@ -363,8 +372,9 @@ impl Keyring {
363372
/// the key. If found, it will be attached to the current keyring. Requires `write` permission
364373
/// to the keyring.
365374
pub fn request_keyring_with_fallback<D, I>(&self, description: D, info: I) -> Result<Self>
366-
where D: AsRef<str>,
367-
I: AsRef<str>,
375+
where
376+
D: AsRef<str>,
377+
I: AsRef<str>,
368378
{
369379
let res = self.request_fallback_impl("keyring", description.as_ref(), info.as_ref())?;
370380
check_call(i64::from(res), Keyring::new_impl(res))
@@ -484,7 +494,8 @@ impl Key {
484494
/// Requests a key with the given description by searching the thread, process, and session
485495
/// keyrings.
486496
pub fn request<D>(description: D) -> Result<Self>
487-
where D: AsRef<str>,
497+
where
498+
D: AsRef<str>,
488499
{
489500
Keyring::new_impl(0).request_key(description)
490501
}
@@ -495,15 +506,17 @@ impl Key {
495506
/// If it is not found, the `info` string will be handed off to `/sbin/request-key` to generate
496507
/// the key.
497508
pub fn request_with_fallback<D, I>(description: D, info: I) -> Result<Self>
498-
where D: AsRef<str>,
499-
I: AsRef<str>,
509+
where
510+
D: AsRef<str>,
511+
I: AsRef<str>,
500512
{
501513
Keyring::new_impl(0).request_key_with_fallback(description, info)
502514
}
503515

504516
/// Update the payload in the key.
505517
pub fn update<D>(&mut self, data: D) -> Result<()>
506-
where D: AsRef<[u8]>,
518+
where
519+
D: AsRef<[u8]>,
507520
{
508521
let data = data.as_ref();
509522
check_call(unsafe {
@@ -664,7 +677,8 @@ impl KeyManager {
664677

665678
/// Instantiate the key with the given payload.
666679
pub fn instantiate<P>(self, keyring: &Keyring, payload: P) -> Result<()>
667-
where P: AsRef<[u8]>,
680+
where
681+
P: AsRef<[u8]>,
668682
{
669683
let payload = payload.as_ref();
670684
check_call(unsafe {

0 commit comments

Comments
 (0)