@@ -6,8 +6,7 @@ use crate::{raw, Error, ErrorClass, ErrorCode, ObjectType, Oid};
6
6
use bitflags:: bitflags;
7
7
use std:: marker:: PhantomData ;
8
8
use std:: mem:: ManuallyDrop ;
9
- use std:: ptr:: NonNull ;
10
- use std:: { ptr, slice} ;
9
+ use std:: { marker, ptr, slice} ;
11
10
12
11
/// A custom implementation of an [`Odb`](crate::Odb) backend.
13
12
///
@@ -347,7 +346,7 @@ bitflags! {
347
346
/// [`git_odb_backend_data_free`]: raw::git_odb_backend_data_free
348
347
pub struct OdbBackendAllocation {
349
348
backend_ptr : * mut raw:: git_odb_backend ,
350
- raw : NonNull < libc:: c_void > ,
349
+ raw : ptr :: NonNull < libc:: c_void > ,
351
350
size : usize ,
352
351
}
353
352
impl OdbBackendAllocation {
@@ -374,7 +373,7 @@ impl OdbBackendContext {
374
373
pub const fn alloc_0 ( & self ) -> OdbBackendAllocation {
375
374
OdbBackendAllocation {
376
375
backend_ptr : self . backend_ptr ,
377
- raw : NonNull :: dangling ( ) ,
376
+ raw : ptr :: NonNull :: dangling ( ) ,
378
377
size : 0 ,
379
378
}
380
379
}
@@ -387,7 +386,7 @@ impl OdbBackendContext {
387
386
pub fn alloc ( & self , size : usize ) -> Option < OdbBackendAllocation > {
388
387
let data =
389
388
unsafe { raw:: git_odb_backend_data_alloc ( self . backend_ptr , size as libc:: size_t ) } ;
390
- let data = NonNull :: new ( data) ?;
389
+ let data = ptr :: NonNull :: new ( data) ?;
391
390
Some ( OdbBackendAllocation {
392
391
backend_ptr : self . backend_ptr ,
393
392
raw : data,
@@ -416,8 +415,8 @@ impl OdbBackendContext {
416
415
/// A handle to an [`OdbBackend`] that has been added to an [`Odb`](crate::Odb).
417
416
pub struct CustomOdbBackend < ' a , B : OdbBackend > {
418
417
// NOTE: Any pointer in this field must be both non-null and properly aligned.
419
- raw : NonNull < Backend < B > > ,
420
- phantom : PhantomData < fn ( ) -> & ' a ( ) > ,
418
+ raw : ptr :: NonNull < Backend < B > > ,
419
+ phantom : marker :: PhantomData < fn ( ) -> & ' a ( ) > ,
421
420
}
422
421
423
422
impl < ' a , B : OdbBackend > CustomOdbBackend < ' a , B > {
@@ -450,10 +449,10 @@ impl<'a, B: OdbBackend> CustomOdbBackend<'a, B> {
450
449
pub ( crate ) fn new ( backend : Box < Backend < B > > ) -> Self {
451
450
// SAFETY: Box::into_raw guarantees that the pointer is properly aligned and non-null
452
451
let backend = Box :: into_raw ( backend) ;
453
- let backend = unsafe { NonNull :: new_unchecked ( backend) } ;
452
+ let backend = unsafe { ptr :: NonNull :: new_unchecked ( backend) } ;
454
453
Self {
455
454
raw : backend,
456
- phantom : PhantomData ,
455
+ phantom : marker :: PhantomData ,
457
456
}
458
457
}
459
458
@@ -598,7 +597,7 @@ impl<B: OdbBackend> Backend<B> {
598
597
. inner
599
598
. read_header ( & context, oid, size, & mut object_type)
600
599
{
601
- unsafe { return e. raw_set_git_error ( ) }
600
+ return unsafe { e. raw_set_git_error ( ) } ;
602
601
} ;
603
602
* otype = object_type. raw ( ) ;
604
603
0 commit comments