Skip to content

From<UnknownVariant> impl for io::Error uses the wrong ErrorKind #24

@SludgePhD

Description

@SludgePhD

evdevil/src/event/codes.rs

Lines 151 to 155 in fa3466b

impl From<UnknownVariant> for io::Error {
fn from(value: UnknownVariant) -> Self {
io::Error::new(io::ErrorKind::InvalidInput, value)
}
}

Seems to me that this should be InvalidData, not InvalidInput. But maybe it would be better to omit this impl entirely and have the caller do the conversion, using the appropriate ErrorKind for its specific use case.

Additionally, the type should probably be renamed to something ending in *Error, to match the convention in the standard library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions