Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Compare error description without allocating
In Tokio we have a piece of code like this:
if inner.description() == MY_ERROR {
}
which checks if an std::io::Error
is the one we created with a specific string using Error::new(ErrorKind::Other, MY_ERROR)
. However, this is broken on recent versions of the Rust language because description()
now returns:
inner.description() = "description() is deprecated; use Display"
How can I update this comparison to avoid description()
without allocating memory?
1 post - 1 participant
🏷️ Rust_feed