Apply suggestions from code review

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
This commit is contained in:
Ralf Jung 2019-07-24 11:45:39 +02:00 committed by GitHub
parent 18551e7d45
commit ff18786683
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,13 +190,13 @@ pub struct InterpErrorInfo<'tcx> {
} }
impl<'tcx> fmt::Display for InterpErrorInfo<'tcx> { impl fmt::Display for InterpErrorInfo<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.kind) write!(f, "{}", self.kind)
} }
} }
impl<'tcx> InterpErrorInfo<'tcx> { impl InterpErrorInfo<'_> {
pub fn print_backtrace(&mut self) { pub fn print_backtrace(&mut self) {
if let Some(ref mut backtrace) = self.backtrace { if let Some(ref mut backtrace) = self.backtrace {
print_backtrace(&mut *backtrace); print_backtrace(&mut *backtrace);
@ -390,14 +390,14 @@ pub enum InterpError<'tcx> {
pub type InterpResult<'tcx, T = ()> = Result<T, InterpErrorInfo<'tcx>>; pub type InterpResult<'tcx, T = ()> = Result<T, InterpErrorInfo<'tcx>>;
impl<'tcx> fmt::Display for InterpError<'tcx> { impl fmt::Display for InterpError<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Forward `Display` to `Debug` // Forward `Display` to `Debug`
write!(f, "{:?}", self) write!(f, "{:?}", self)
} }
} }
impl<'tcx> fmt::Debug for InterpError<'tcx> { impl fmt::Debug for InterpError<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use InterpError::*; use InterpError::*;
match *self { match *self {