~ireas/nitrokey-rs

89f9daf6298b9f81037bf22da8695d2967ab8221 — Robin Krahl 2 months ago 8853c14
Implement From<LogLevel> for i32

Previously, we implemented Into<i32> for LogLevel.  As implementing From
is preferred over Into, this patch replaces this implementation with
From<LogLevel> for i32.
1 files changed, 3 insertions(+), 3 deletions(-)

M src/util.rs
M src/util.rs => src/util.rs +3 -3
@@ 113,9 113,9 @@ pub fn get_cstring<T: Into<Vec<u8>>>(s: T) -> Result<CString, Error> {
    CString::new(s).map_err(|_| LibraryError::InvalidString.into())
}

impl Into<i32> for LogLevel {
    fn into(self) -> i32 {
        match self {
impl From<LogLevel> for i32 {
    fn from(log_level: LogLevel) -> i32 {
        match log_level {
            LogLevel::Error => 0,
            LogLevel::Warning => 1,
            LogLevel::Info => 2,