@@ -2140,16 +2140,6 @@ impl Termination for () {
2140
2140
}
2141
2141
}
2142
2142
2143
- #[ stable( feature = "termination_trait_lib" , since = "1.61.0" ) ]
2144
- impl < E : fmt:: Debug > Termination for Result < ( ) , E > {
2145
- fn report ( self ) -> ExitCode {
2146
- match self {
2147
- Ok ( ( ) ) => ( ) . report ( ) ,
2148
- Err ( err) => Err :: < !, _ > ( err) . report ( ) ,
2149
- }
2150
- }
2151
- }
2152
-
2153
2143
#[ stable( feature = "termination_trait_lib" , since = "1.61.0" ) ]
2154
2144
impl Termination for ! {
2155
2145
fn report ( self ) -> ExitCode {
@@ -2158,28 +2148,31 @@ impl Termination for ! {
2158
2148
}
2159
2149
2160
2150
#[ stable( feature = "termination_trait_lib" , since = "1.61.0" ) ]
2161
- impl < E : fmt :: Debug > Termination for Result < ! , E > {
2151
+ impl Termination for Infallible {
2162
2152
fn report ( self ) -> ExitCode {
2163
- let Err ( err) = self ;
2164
- // Ignore error if the write fails, for example because stderr is
2165
- // already closed. There is not much point panicking at this point.
2166
- let _ = writeln ! ( io:: stderr( ) , "Error: {err:?}" ) ;
2167
- ExitCode :: FAILURE
2153
+ match self { }
2168
2154
}
2169
2155
}
2170
2156
2171
2157
#[ stable( feature = "termination_trait_lib" , since = "1.61.0" ) ]
2172
- impl < E : fmt:: Debug > Termination for Result < Infallible , E > {
2158
+ impl Termination for ExitCode {
2159
+ #[ inline]
2173
2160
fn report ( self ) -> ExitCode {
2174
- let Err ( err) = self ;
2175
- Err :: < !, _ > ( err) . report ( )
2161
+ self
2176
2162
}
2177
2163
}
2178
2164
2179
2165
#[ stable( feature = "termination_trait_lib" , since = "1.61.0" ) ]
2180
- impl Termination for ExitCode {
2181
- #[ inline]
2166
+ impl < T : Termination , E : fmt:: Debug > Termination for Result < T , E > {
2182
2167
fn report ( self ) -> ExitCode {
2183
- self
2168
+ match self {
2169
+ Ok ( val) => val. report ( ) ,
2170
+ Err ( err) => {
2171
+ // Ignore error if the write fails, for example because stderr is
2172
+ // already closed. There is not much point panicking at this point.
2173
+ let _ = writeln ! ( io:: stderr( ) , "Error: {err:?}" ) ;
2174
+ ExitCode :: FAILURE
2175
+ }
2176
+ }
2184
2177
}
2185
2178
}
0 commit comments