RS.CLIPPY.IO_OTHER_ERROR

Calling `std::io::Error::new(std::io::ErrorKind::Other, _)`

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: io_other_error. Copyright ©2025 The Rust Team. All rights reserved.

This lint warns on calling io::Error::new(..) with a kind of io::ErrorKind::Other.

Why is this bad?

Since Rust 1.74, there's the io::Error::other(_) shortcut.

Example

use std::io;
let _ = io::Error::new(io::ErrorKind::Other, "bad".to_string());

Use instead:

let _ = std::io::Error::other("bad".to_string());

Configuration

  • msrv: The minimum rust version that the project supports. Defaults to the rust-version field in Cargo.toml

    (default: current version)