Skip to content

Commit 70cc3b9

Browse files
committed
cargo fmt
1 parent dfdf78f commit 70cc3b9

File tree

9 files changed

+15
-43
lines changed

9 files changed

+15
-43
lines changed

src/build.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,7 @@ impl<'cb> CheckoutBuilder<'cb> {
475475
/// callback.
476476
///
477477
/// Defaults to none.
478-
pub fn notify_on(
479-
&mut self,
480-
notification_types: CheckoutNotificationType,
481-
) -> &mut Self {
478+
pub fn notify_on(&mut self, notification_types: CheckoutNotificationType) -> &mut Self {
482479
self.notify_flags = notification_types;
483480
self
484481
}

src/cred.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,7 @@ impl CredentialHelper {
312312

313313
fn url_key(&self, name: &str) -> Option<String> {
314314
match (&self.host, &self.protocol) {
315-
(Some(host), Some(protocol)) => {
316-
Some(format!("credential.{protocol}://{host}.{name}"))
317-
}
315+
(Some(host), Some(protocol)) => Some(format!("credential.{protocol}://{host}.{name}")),
318316
_ => None,
319317
}
320318
}

src/diff.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,12 +1048,7 @@ impl<'a> DiffLine<'a> {
10481048

10491049
/// Content of this line as bytes.
10501050
pub fn content(&self) -> &'a [u8] {
1051-
unsafe {
1052-
slice::from_raw_parts(
1053-
(*self.raw).content as *const u8,
1054-
(*self.raw).content_len,
1055-
)
1056-
}
1051+
unsafe { slice::from_raw_parts((*self.raw).content as *const u8, (*self.raw).content_len) }
10571052
}
10581053

10591054
/// origin of this `DiffLine`.
@@ -1277,9 +1272,7 @@ impl<'a> DiffBinaryFile<'a> {
12771272

12781273
/// The binary data, deflated
12791274
pub fn data(&self) -> &[u8] {
1280-
unsafe {
1281-
slice::from_raw_parts((*self.raw).data as *const u8, (*self.raw).datalen)
1282-
}
1275+
unsafe { slice::from_raw_parts((*self.raw).data as *const u8, (*self.raw).datalen) }
12831276
}
12841277

12851278
/// The length of the binary data after inflation

src/odb.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ impl<'repo> Drop for OdbPackwriter<'repo> {
507507
fn drop(&mut self) {
508508
unsafe {
509509
let writepack = &*self.raw;
510-
if let Some(free) = writepack.free { free(self.raw) };
510+
if let Some(free) = writepack.free {
511+
free(self.raw)
512+
};
511513

512514
drop(Box::from_raw(self.progress_payload_ptr));
513515
}

src/reference.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,7 @@ impl<'repo> Reference<'repo> {
339339
///
340340
/// If the force flag is not enabled, and there's already a reference with
341341
/// the given name, the renaming will fail.
342-
pub fn rename(
343-
&mut self,
344-
new_name: &str,
345-
force: bool,
346-
msg: &str,
347-
) -> Result<Self, Error> {
342+
pub fn rename(&mut self, new_name: &str, force: bool, msg: &str) -> Result<Self, Error> {
348343
let mut raw = ptr::null_mut();
349344
let new_name = CString::new(new_name)?;
350345
let msg = CString::new(msg)?;
@@ -389,11 +384,7 @@ impl<'repo> Reference<'repo> {
389384
/// The message for the reflog will be ignored if the reference does not
390385
/// belong in the standard set (HEAD, branches and remote-tracking
391386
/// branches) and it does not have a reflog.
392-
pub fn symbolic_set_target(
393-
&mut self,
394-
target: &str,
395-
reflog_msg: &str,
396-
) -> Result<Self, Error> {
387+
pub fn symbolic_set_target(&mut self, target: &str, reflog_msg: &str) -> Result<Self, Error> {
397388
let mut raw = ptr::null_mut();
398389
let target = CString::new(target)?;
399390
let msg = CString::new(reflog_msg)?;

src/repo.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,7 @@ impl Repository {
308308
/// Creates a new repository in the specified folder with the given options.
309309
///
310310
/// See `RepositoryInitOptions` struct for more information.
311-
pub fn init_opts<P: AsRef<Path>>(
312-
path: P,
313-
opts: &RepositoryInitOptions,
314-
) -> Result<Self, Error> {
311+
pub fn init_opts<P: AsRef<Path>>(path: P, opts: &RepositoryInitOptions) -> Result<Self, Error> {
315312
crate::init();
316313
// Normal file path OK (does not need Windows conversion).
317314
let path = path.as_ref().into_c_string()?;
@@ -3467,11 +3464,7 @@ impl RepositoryInitOptions {
34673464
self.flag(raw::GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE, enabled)
34683465
}
34693466

3470-
fn flag(
3471-
&mut self,
3472-
flag: raw::git_repository_init_flag_t,
3473-
on: bool,
3474-
) -> &mut Self {
3467+
fn flag(&mut self, flag: raw::git_repository_init_flag_t, on: bool) -> &mut Self {
34753468
if on {
34763469
self.flags |= flag;
34773470
} else {

src/submodule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl<'cb> SubmoduleUpdateOptions<'cb> {
290290
raw::git_checkout_init_options(&mut checkout_opts, raw::GIT_CHECKOUT_OPTIONS_VERSION);
291291
assert_eq!(0, init_res);
292292
self.checkout_builder.configure(&mut checkout_opts);
293-
293+
294294
raw::git_submodule_update_options {
295295
version: raw::GIT_SUBMODULE_UPDATE_OPTIONS_VERSION,
296296
checkout_opts,

src/tree.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ extern "C" fn treewalk_cb<T: Into<i32>>(
224224
let payload = &mut *(payload as *mut TreeWalkCbData<'_, T>);
225225
let callback = &mut payload.callback;
226226
callback(root, &entry).into()
227-
}).unwrap_or(-1)
227+
})
228+
.unwrap_or(-1)
228229
}
229230

230231
impl<'repo> Binding for Tree<'repo> {

src/worktree.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,7 @@ impl<'a> WorktreeAddOptions<'a> {
178178
}
179179

180180
/// reference to use for the new worktree HEAD
181-
pub fn reference(
182-
&mut self,
183-
reference: Option<&'a Reference<'_>>,
184-
) -> &mut Self {
181+
pub fn reference(&mut self, reference: Option<&'a Reference<'_>>) -> &mut Self {
185182
self.raw.reference = if let Some(reference) = reference {
186183
reference.raw()
187184
} else {

0 commit comments

Comments
 (0)