@@ -990,15 +990,15 @@ fn foo(&self) -> Self::T { String::new() }
990990 false
991991 }
992992
993- pub fn short_ty_string ( self , ty : Ty < ' tcx > ) -> Result < String , ( String , PathBuf ) > {
993+ pub fn short_ty_string ( self , ty : Ty < ' tcx > ) -> ( String , Option < PathBuf > ) {
994994 let length_limit = 50 ;
995995 let type_limit = 4 ;
996996 let regular = FmtPrinter :: new ( self , hir:: def:: Namespace :: TypeNS )
997997 . pretty_print_type ( ty)
998998 . expect ( "could not write to `String`" )
999999 . into_buffer ( ) ;
10001000 if regular. len ( ) <= length_limit {
1001- return Ok ( regular) ;
1001+ return ( regular, None ) ;
10021002 }
10031003 let short = FmtPrinter :: new_with_limit (
10041004 self ,
@@ -1009,16 +1009,16 @@ fn foo(&self) -> Self::T { String::new() }
10091009 . expect ( "could not write to `String`" )
10101010 . into_buffer ( ) ;
10111011 if regular == short {
1012- return Ok ( regular) ;
1012+ return ( regular, None ) ;
10131013 }
10141014 // Multiple types might be shortened in a single error, ensure we create a file for each.
10151015 let mut s = DefaultHasher :: new ( ) ;
10161016 ty. hash ( & mut s) ;
10171017 let hash = s. finish ( ) ;
10181018 let path = self . output_filenames ( ( ) ) . temp_path_ext ( & format ! ( "long-type-{hash}.txt" ) , None ) ;
10191019 match std:: fs:: write ( & path, & regular) {
1020- Ok ( _) => Err ( ( short, path) ) ,
1021- Err ( _) => Ok ( regular) ,
1020+ Ok ( _) => ( short, Some ( path) ) ,
1021+ Err ( _) => ( regular, None ) ,
10221022 }
10231023 }
10241024
0 commit comments