This repository was archived by the owner on Aug 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ fn wrap_backtrace_error() {
5858 . and_then( |err| err. downcast_ref:: <io:: Error >( ) )
5959 . is_some( ) ) ;
6060 assert ! ( err. backtrace( ) . is_some( ) ) ;
61+ assert ! ( err. backtrace( ) . is_empty( ) ) ;
62+ assert_eq ! ( err. backtrace( ) . is_empty( ) , err. backtrace( ) . to_string( ) . trim( ) . is_empty( ) ) ;
6163}
6264
6365#[ derive( Fail , Debug ) ]
@@ -91,4 +93,6 @@ fn wrap_enum_error() {
9193 . and_then( |err| err. downcast_ref:: <fmt:: Error >( ) )
9294 . is_some( ) ) ;
9395 assert ! ( err. backtrace( ) . is_some( ) ) ;
96+ assert ! ( err. backtrace( ) . is_empty( ) ) ;
97+ assert_eq ! ( err. backtrace( ) . is_empty( ) , err. backtrace( ) . to_string( ) . trim( ) . is_empty( ) ) ;
9498}
Original file line number Diff line number Diff line change @@ -52,6 +52,16 @@ without_backtrace! {
5252 pub ( crate ) fn is_none( & self ) -> bool {
5353 true
5454 }
55+
56+ /// Returns true if displaying this backtrace would be an empty string.
57+ ///
58+ /// > (We have detected that this crate was documented with no_std
59+ /// > compatibility turned on. The version of this crate that has been
60+ /// > documented here will never generate a backtrace and this method
61+ /// > will always return true.)
62+ pub fn is_empty( & self ) -> bool {
63+ true
64+ }
5565 }
5666
5767 impl Default for Backtrace {
@@ -118,6 +128,11 @@ with_backtrace! {
118128 pub ( crate ) fn is_none( & self ) -> bool {
119129 self . internal. is_none( )
120130 }
131+
132+ /// Returns true if displaying this backtrace would be an empty string.
133+ pub fn is_empty( & self ) -> bool {
134+ self . internal. is_none( )
135+ }
121136 }
122137
123138 impl Default for Backtrace {
You can’t perform that action at this time.
0 commit comments