From 248f752748a0033db7f8242ee0ecd73ea8ce8ec9 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 22 Apr 2022 04:33:58 +0000 Subject: simplify error handling --- azalea-nbt/src/error.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) mode change 100644 => 100755 azalea-nbt/src/error.rs (limited to 'azalea-nbt/src/error.rs') diff --git a/azalea-nbt/src/error.rs b/azalea-nbt/src/error.rs old mode 100644 new mode 100755 index 05ff15e0..278d2770 --- a/azalea-nbt/src/error.rs +++ b/azalea-nbt/src/error.rs @@ -14,3 +14,14 @@ impl std::fmt::Display for Error { } } } + +impl From for Error { + fn from(err: std::io::Error) -> Self { + Error::WriteError + } +} +impl From for Error { + fn from(err: std::string::FromUtf8Error) -> Self { + Error::WriteError + } +} \ No newline at end of file -- cgit v1.2.3 From 97d392f4e5721d8aa8940f253918965ff0b40348 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 24 Apr 2022 14:56:46 -0500 Subject: fix warnings in azalea-nbt --- azalea-nbt/benches/my_benchmark.rs | 2 +- azalea-nbt/src/error.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'azalea-nbt/src/error.rs') diff --git a/azalea-nbt/benches/my_benchmark.rs b/azalea-nbt/benches/my_benchmark.rs index fcb44f90..2fc7ec2f 100755 --- a/azalea-nbt/benches/my_benchmark.rs +++ b/azalea-nbt/benches/my_benchmark.rs @@ -3,7 +3,7 @@ use criterion::{criterion_group, criterion_main, Criterion, Throughput}; use flate2::read::GzDecoder; use std::{ fs::File, - io::{self, Cursor, Read, Seek, SeekFrom}, + io::{self, Read, Seek, SeekFrom}, }; fn bench_serialize(filename: &str, c: &mut Criterion) { diff --git a/azalea-nbt/src/error.rs b/azalea-nbt/src/error.rs index 278d2770..219921e4 100755 --- a/azalea-nbt/src/error.rs +++ b/azalea-nbt/src/error.rs @@ -16,12 +16,12 @@ impl std::fmt::Display for Error { } impl From for Error { - fn from(err: std::io::Error) -> Self { + fn from(_: std::io::Error) -> Self { Error::WriteError } } impl From for Error { - fn from(err: std::string::FromUtf8Error) -> Self { + fn from(_: std::string::FromUtf8Error) -> Self { Error::WriteError } -} \ No newline at end of file +} -- cgit v1.2.3