Skip to content

Commit bf638d9

Browse files
committed
chore: Run cargo fmt
1 parent 3f9dc0b commit bf638d9

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/odb.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use std::ffi::CString;
77

88
use libc::{c_char, c_int, c_uint, c_void, size_t};
99

10+
use crate::odb_backend::{CustomOdbBackend, OdbBackend};
1011
use crate::panic;
1112
use crate::util::Binding;
1213
use crate::{
1314
raw, Error, IndexerProgress, Mempack, Object, ObjectType, OdbLookupFlags, Oid, Progress,
1415
};
15-
use crate::odb_backend::{CustomOdbBackend, OdbBackend};
1616

1717
/// A structure to represent a git object database
1818
pub struct Odb<'repo> {
@@ -275,10 +275,18 @@ impl<'repo> Odb<'repo> {
275275
/// Returns a handle to the backend.
276276
///
277277
/// `backend` will be dropped when this Odb is dropped.
278-
pub fn add_custom_backend<'odb, B: OdbBackend + 'odb>(&'odb self, backend: B, priority: i32) -> Result<CustomOdbBackend<'odb, B>, Error> {
278+
pub fn add_custom_backend<'odb, B: OdbBackend + 'odb>(
279+
&'odb self,
280+
backend: B,
281+
priority: i32,
282+
) -> Result<CustomOdbBackend<'odb, B>, Error> {
279283
let mut inner = CustomOdbBackend::new_inner(backend);
280284
unsafe {
281-
try_call!(raw::git_odb_add_backend(self.raw, ptr::from_mut(inner.as_mut()).cast(), priority as c_int));
285+
try_call!(raw::git_odb_add_backend(
286+
self.raw,
287+
ptr::from_mut(inner.as_mut()).cast(),
288+
priority as c_int
289+
));
282290
Ok(CustomOdbBackend::new(inner))
283291
}
284292
}

src/odb_backend.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ impl OdbBackendContext {
277277
/// `Some(allocation)` if the allocation succeeded.
278278
/// `None` otherwise. This usually indicates that there is not enough memory.
279279
pub fn alloc(&self, size: usize) -> Option<OdbBackendAllocation> {
280-
let data = unsafe { raw::git_odb_backend_data_alloc(self.backend_ptr, size as libc::size_t) };
280+
let data =
281+
unsafe { raw::git_odb_backend_data_alloc(self.backend_ptr, size as libc::size_t) };
281282
let data = NonNull::new(data)?;
282283
Some(OdbBackendAllocation {
283284
backend_ptr: self.backend_ptr,
@@ -514,14 +515,17 @@ impl<B: OdbBackend> Backend<B> {
514515
oid_ptr: *mut raw::git_oid,
515516
backend_ptr: *mut raw::git_odb_backend,
516517
oid_prefix_ptr: *const raw::git_oid,
517-
oid_prefix_len: libc::size_t
518+
oid_prefix_len: libc::size_t,
518519
) -> libc::c_int {
519520
let backend = unsafe { backend_ptr.cast::<Self>().as_mut().unwrap() };
520521
let oid_prefix = unsafe { Oid::from_raw(oid_prefix_ptr) };
521522
let oid = unsafe { oid_ptr.cast::<Oid>().as_mut().unwrap() };
522523

523524
let context = OdbBackendContext { backend_ptr };
524-
*oid = match backend.inner.exists_prefix(&context, oid_prefix, oid_prefix_len) {
525+
*oid = match backend
526+
.inner
527+
.exists_prefix(&context, oid_prefix, oid_prefix_len)
528+
{
525529
Err(e) => return unsafe { e.raw_set_git_error() },
526530
Ok(x) => x,
527531
};

0 commit comments

Comments
 (0)