From e83762d3b16f6af8245a359c4569efd205b1d3f0 Mon Sep 17 00:00:00 2001 From: Kornel Date: Fri, 6 Jul 2018 12:26:49 +0100 Subject: [PATCH] Remove deprecated Error::description (#109) --- tests/filters.rs | 5 ++--- tests/flags.rs | 45 ++++++++++++++++++++++----------------------- tests/interlaced.rs | 5 ++--- tests/reduction.rs | 17 ++++++++--------- tests/regression.rs | 9 ++++----- 5 files changed, 38 insertions(+), 43 deletions(-) diff --git a/tests/filters.rs b/tests/filters.rs index 0d976fff..8dc951eb 100644 --- a/tests/filters.rs +++ b/tests/filters.rs @@ -3,7 +3,6 @@ extern crate oxipng; use oxipng::colors::{BitDepth, ColorType}; use oxipng::png; use std::collections::HashSet; -use std::error::Error; use std::fs::remove_file; use std::path::Path; use std::path::PathBuf; @@ -36,7 +35,7 @@ fn test_it_converts( match oxipng::optimize(input, opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -44,7 +43,7 @@ fn test_it_converts( Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; diff --git a/tests/flags.rs b/tests/flags.rs index 6558ec9f..55aabf6e 100644 --- a/tests/flags.rs +++ b/tests/flags.rs @@ -5,7 +5,6 @@ use oxipng::deflate::Deflaters; use oxipng::headers::Headers; use oxipng::png; use std::collections::HashSet; -use std::error::Error; use std::fs::remove_file; use std::path::Path; use std::path::PathBuf; @@ -38,7 +37,7 @@ fn test_it_converts( match oxipng::optimize(input, opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -46,7 +45,7 @@ fn test_it_converts( Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -89,7 +88,7 @@ fn strip_headers_list() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -97,7 +96,7 @@ fn strip_headers_list() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -123,7 +122,7 @@ fn strip_headers_safe() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -131,7 +130,7 @@ fn strip_headers_safe() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -157,7 +156,7 @@ fn strip_headers_all() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -165,7 +164,7 @@ fn strip_headers_all() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -191,7 +190,7 @@ fn strip_headers_none() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -199,7 +198,7 @@ fn strip_headers_none() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -223,7 +222,7 @@ fn interlacing_0_to_1() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -231,7 +230,7 @@ fn interlacing_0_to_1() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -253,7 +252,7 @@ fn interlacing_1_to_0() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -261,7 +260,7 @@ fn interlacing_1_to_0() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -285,7 +284,7 @@ fn interlacing_0_to_1_small_files() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -293,7 +292,7 @@ fn interlacing_0_to_1_small_files() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -319,7 +318,7 @@ fn interlacing_1_to_0_small_files() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -327,7 +326,7 @@ fn interlacing_1_to_0_small_files() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -354,7 +353,7 @@ fn interlaced_0_to_1_other_filter_mode() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -362,7 +361,7 @@ fn interlaced_0_to_1_other_filter_mode() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -405,7 +404,7 @@ fn fix_errors() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -413,7 +412,7 @@ fn fix_errors() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; diff --git a/tests/interlaced.rs b/tests/interlaced.rs index 9c70a63d..68ab09fe 100644 --- a/tests/interlaced.rs +++ b/tests/interlaced.rs @@ -3,7 +3,6 @@ extern crate oxipng; use oxipng::colors::{BitDepth, ColorType}; use oxipng::png; use std::collections::HashSet; -use std::error::Error; use std::fs::remove_file; use std::path::Path; use std::path::PathBuf; @@ -37,7 +36,7 @@ fn test_it_converts( match oxipng::optimize(input, opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -45,7 +44,7 @@ fn test_it_converts( Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; diff --git a/tests/reduction.rs b/tests/reduction.rs index ab4b7535..ad8d150b 100644 --- a/tests/reduction.rs +++ b/tests/reduction.rs @@ -3,7 +3,6 @@ extern crate oxipng; use oxipng::colors::{AlphaOptim, BitDepth, ColorType}; use oxipng::png; use std::collections::HashSet; -use std::error::Error; use std::fs::remove_file; use std::path::Path; use std::path::PathBuf; @@ -37,7 +36,7 @@ fn test_it_converts( match oxipng::optimize(input, opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -45,7 +44,7 @@ fn test_it_converts( Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -987,7 +986,7 @@ fn palette_should_be_reduced_with_dupes() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -995,7 +994,7 @@ fn palette_should_be_reduced_with_dupes() { Ok(x) => x, Err(x) => { remove_file(&output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -1020,7 +1019,7 @@ fn palette_should_be_reduced_with_unused() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -1028,7 +1027,7 @@ fn palette_should_be_reduced_with_unused() { Ok(x) => x, Err(x) => { remove_file(&output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -1053,7 +1052,7 @@ fn palette_should_be_reduced_with_both() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -1061,7 +1060,7 @@ fn palette_should_be_reduced_with_both() { Ok(x) => x, Err(x) => { remove_file(&output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; diff --git a/tests/regression.rs b/tests/regression.rs index 59d5e2f4..44f027dc 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -3,7 +3,6 @@ extern crate oxipng; use oxipng::colors::{BitDepth, ColorType}; use oxipng::png; use std::collections::HashSet; -use std::error::Error; use std::fs::remove_file; use std::path::Path; use std::path::PathBuf; @@ -36,7 +35,7 @@ fn test_it_converts( match oxipng::optimize(input, opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -44,7 +43,7 @@ fn test_it_converts( Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } }; @@ -86,7 +85,7 @@ fn issue_42() { match oxipng::optimize(&input, &opts) { Ok(_) => (), - Err(x) => panic!(x.description().to_owned()), + Err(x) => panic!("{}", x), }; assert!(output.exists()); @@ -94,7 +93,7 @@ fn issue_42() { Ok(x) => x, Err(x) => { remove_file(output).ok(); - panic!(x.description().to_owned()) + panic!("{}", x) } };