Skip to content

Commit

Permalink
refactor(resovler): replace Into with From
Browse files Browse the repository at this point in the history
  • Loading branch information
msdlisper authored and Boshen committed Nov 11, 2023
1 parent 2390599 commit 301e648
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions crates/oxc_resolver/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ impl PartialEq for IOError {
}
}

impl Into<std::io::Error> for IOError {
fn into(self) -> std::io::Error {
let io_error = self.0.as_ref();
io::Error::new(io_error.kind(), io_error.to_string())
impl From<IOError> for std::io::Error {
fn from(error: IOError) -> Self {
let io_error = error.0.as_ref();
Self::new(io_error.kind(), io_error.to_string())
}
}

Expand Down
8 changes: 4 additions & 4 deletions crates/oxc_resolver/src/tests/imports_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1304,9 +1304,9 @@ fn test_into_io_error() {
let resolve_io_error: ResolveError = string_error.into();

if let ResolveError::IOError(io_error) = resolve_io_error {
// trait for https://github.com/web-infra-dev/rspack/issues/4564
let std_io_error: std::io::Error = io_error.into();
assert_eq!(std_io_error.kind(), ErrorKind::Interrupted);
assert_eq!(std_io_error.to_string(), error_string)
// fix for https://github.com/web-infra-dev/rspack/issues/4564
let std_io_error: std::io::Error = io_error.into();
assert_eq!(std_io_error.kind(), ErrorKind::Interrupted);
assert_eq!(std_io_error.to_string(), error_string);
}
}

0 comments on commit 301e648

Please sign in to comment.