Skip to content

Commit

Permalink
Implement From instead of Into for newtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
ramosbugs committed Feb 21, 2024
1 parent b19ad89 commit d9402c4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::Into;
use std::fmt::Error as FormatterError;
use std::fmt::{Debug, Formatter};
#[cfg(feature = "timing-resistant-secret-traits")]
Expand Down Expand Up @@ -96,9 +95,9 @@ macro_rules! new_type {
&self.0
}
}
impl Into<$type> for $name {
fn into(self) -> $type {
self.0
impl From<$name> for $type {
fn from(t: $name) -> $type {
t.0
}
}
}
Expand Down

0 comments on commit d9402c4

Please sign in to comment.