@@ -20,8 +20,10 @@ macro_rules! get_item_from {
2020 ( $oid: expr, $repo: expr, $typs: ident) => {
2121 git_repository:: hash:: ObjectId :: from( $oid)
2222 . attach( & $repo)
23- . object( ) . map_err( |_| "Could not find object" ) ?
24- . $typs( ) . map_err( |_| format!( "Could not find {} from object" , stringify!( $typs) ) ) ?
23+ . object( )
24+ . map_err( |_| "Could not find object" ) ?
25+ . $typs( )
26+ . map_err( |_| format!( "Could not find {} from object" , stringify!( $typs) ) ) ?
2527 } ;
2628}
2729
@@ -414,8 +416,11 @@ fn traverse_tree(
414416 }
415417 } ,
416418 }
417- let obh = repo. find_object ( i. oid ( ) ) . map_err ( |_| "failed to find object" ) ?;
418- let objref = objs:: ObjectRef :: from_bytes ( obh. kind , & obh. data ) . map_err ( |_| "failed to get object ref" ) ?;
419+ let obh = repo
420+ . find_object ( i. oid ( ) )
421+ . map_err ( |_| "failed to find object" ) ?;
422+ let objref = objs:: ObjectRef :: from_bytes ( obh. kind , & obh. data )
423+ . map_err ( |_| "failed to get object ref" ) ?;
419424 let blob = objref. into_blob ( ) ;
420425 if let Some ( blob) = blob {
421426 files. push ( ( file, String :: from_utf8_lossy ( blob. data ) . to_string ( ) ) ) ;
@@ -534,7 +539,7 @@ fn find_function_in_file_with_commit(
534539) -> Result < FileType , String > {
535540 let file = match langs {
536541 Language :: Rust => {
537- let functions = rust:: find_function_in_file ( fc, name) ?;
542+ let functions = rust:: find_function_in_file ( fc, name) ?;
538543 FileType :: Rust ( RustFile :: new ( file_path. to_string ( ) , functions) )
539544 }
540545 // #[cfg(feature = "c_lang")]
@@ -544,25 +549,24 @@ fn find_function_in_file_with_commit(
544549 // }
545550 #[ cfg( feature = "unstable" ) ]
546551 Language :: Go => {
547- let functions = languages:: go:: find_function_in_file ( fc, name) ?;
552+ let functions = languages:: go:: find_function_in_file ( fc, name) ?;
548553 FileType :: Go ( GoFile :: new ( file_path. to_string ( ) , functions) )
549554 }
550555 Language :: Python => {
551- let functions = languages:: python:: find_function_in_file ( fc, name) ?;
556+ let functions = languages:: python:: find_function_in_file ( fc, name) ?;
552557 FileType :: Python ( PythonFile :: new ( file_path. to_string ( ) , functions) )
553558 }
554559 Language :: Ruby => {
555- let functions = languages:: ruby:: find_function_in_file ( fc, name) ?;
560+ let functions = languages:: ruby:: find_function_in_file ( fc, name) ?;
556561 FileType :: Ruby ( RubyFile :: new ( file_path. to_string ( ) , functions) )
557562 }
558563 Language :: UMPL => {
559- let functions = languages:: umpl:: find_function_in_file ( fc, name) ?;
564+ let functions = languages:: umpl:: find_function_in_file ( fc, name) ?;
560565 FileType :: UMPL ( UMPLFile :: new ( file_path. to_string ( ) , functions) )
561566 }
562567 Language :: All => match file_path. split ( '.' ) . last ( ) {
563568 Some ( "rs" ) => {
564-
565- let functions = rust:: find_function_in_file ( fc, name) ?;
569+ let functions = rust:: find_function_in_file ( fc, name) ?;
566570 FileType :: Rust ( RustFile :: new ( file_path. to_string ( ) , functions) )
567571 }
568572 // #[cfg(feature = "c_lang")]
@@ -571,16 +575,16 @@ fn find_function_in_file_with_commit(
571575 // FileType::C(CFile::new(file_path.to_string(), functions))
572576 // }
573577 Some ( "py" | "pyw" ) => {
574- let functions = languages:: python:: find_function_in_file ( fc, name) ?;
578+ let functions = languages:: python:: find_function_in_file ( fc, name) ?;
575579 FileType :: Python ( PythonFile :: new ( file_path. to_string ( ) , functions) )
576580 }
577581 #[ cfg( feature = "unstable" ) ]
578582 Some ( "go" ) => {
579- let functions = languages:: go:: find_function_in_file ( fc, name) ?;
583+ let functions = languages:: go:: find_function_in_file ( fc, name) ?;
580584 FileType :: Go ( GoFile :: new ( file_path. to_string ( ) , functions) )
581585 }
582586 Some ( "rb" ) => {
583- let functions = languages:: ruby:: find_function_in_file ( fc, name) ?;
587+ let functions = languages:: ruby:: find_function_in_file ( fc, name) ?;
584588 FileType :: Ruby ( RubyFile :: new ( file_path. to_string ( ) , functions) )
585589 }
586590 _ => Err ( "unknown file type" ) ?,
@@ -618,7 +622,6 @@ trait UnwrapToError<T> {
618622}
619623
620624impl < T > UnwrapToError < T > for Option < T > {
621-
622625 fn unwrap_to_error ( self , message : & str ) -> Result < T , String > {
623626 self . map_or_else ( || Err ( message. to_string ( ) ) , |val| Ok ( val) )
624627 }
0 commit comments