Compare error description without allocating
⚓ Rust 📅 2025-10-13 👤 surdeus 👁️ 7In 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