diff --git a/Cargo.toml.public-private-dependencies b/Cargo.toml.public-private-dependencies
index 671dea984a..9925be68b9 100644
--- a/Cargo.toml.public-private-dependencies
+++ b/Cargo.toml.public-private-dependencies
@@ -3,8 +3,8 @@ cargo-features = ["public-dependency"]
[package]
name = "image"
version = "0.24.0-alpha"
-edition = "2018"
-rust-version = "1.56"
+edition = "2021"
+rust-version = "1.63.0"
license = "MIT"
description = "Imaging library written in Rust. Provides basic filters and decoders for the most common image formats."
diff --git a/src/animation.rs b/src/animation.rs
index 74bfee2cb7..0f3b4cafb1 100644
--- a/src/animation.rs
+++ b/src/animation.rs
@@ -1,5 +1,4 @@
use std::cmp::Ordering;
-use std::iter::Iterator;
use std::time::Duration;
use crate::error::ImageResult;
diff --git a/src/codecs/avif/decoder.rs b/src/codecs/avif/decoder.rs
index 1efe1443b5..4c84a2fd0e 100644
--- a/src/codecs/avif/decoder.rs
+++ b/src/codecs/avif/decoder.rs
@@ -3,7 +3,6 @@
/// The [AVIF] specification defines an image derivative of the AV1 bitstream, an open video codec.
///
/// [AVIF]: https://aomediacodec.github.io/av1-avif/
-use std::convert::TryFrom;
use std::error::Error;
use std::io::{self, Cursor, Read};
use std::marker::PhantomData;
diff --git a/src/codecs/bmp/decoder.rs b/src/codecs/bmp/decoder.rs
index 983b989165..ab8fa1b0d8 100644
--- a/src/codecs/bmp/decoder.rs
+++ b/src/codecs/bmp/decoder.rs
@@ -1,7 +1,6 @@
use std::cmp::{self, Ordering};
-use std::convert::TryFrom;
use std::io::{self, Cursor, Read, Seek, SeekFrom};
-use std::iter::{repeat, Iterator, Rev};
+use std::iter::{repeat, Rev};
use std::marker::PhantomData;
use std::slice::ChunksMut;
use std::{error, fmt, mem};
diff --git a/src/codecs/dxt.rs b/src/codecs/dxt.rs
index b971187993..63f6bf3300 100644
--- a/src/codecs/dxt.rs
+++ b/src/codecs/dxt.rs
@@ -7,7 +7,6 @@
//!
//! Note: this module only implements bare DXT encoding/decoding, it does not parse formats that can contain DXT files like .dds
-use std::convert::TryFrom;
use std::io::{self, Read, Seek, SeekFrom, Write};
use crate::color::ColorType;
diff --git a/src/codecs/farbfeld.rs b/src/codecs/farbfeld.rs
index b6dcd0565f..bcfeee4b27 100644
--- a/src/codecs/farbfeld.rs
+++ b/src/codecs/farbfeld.rs
@@ -16,7 +16,6 @@
//! # Related Links
//! * - the farbfeld specification
-use std::convert::{TryFrom, TryInto};
use std::i64;
use std::io::{self, Read, Seek, SeekFrom, Write};
diff --git a/src/codecs/gif.rs b/src/codecs/gif.rs
index afa8b5b53b..dffd985bbf 100644
--- a/src/codecs/gif.rs
+++ b/src/codecs/gif.rs
@@ -26,8 +26,6 @@
//! ```
#![allow(clippy::while_let_loop)]
-use std::convert::TryFrom;
-use std::convert::TryInto;
use std::io::{self, Cursor, Read, Write};
use std::marker::PhantomData;
use std::mem;
diff --git a/src/codecs/hdr/decoder.rs b/src/codecs/hdr/decoder.rs
index 8329d577e1..6413e05942 100644
--- a/src/codecs/hdr/decoder.rs
+++ b/src/codecs/hdr/decoder.rs
@@ -2,9 +2,7 @@ use crate::Primitive;
use num_traits::identities::Zero;
#[cfg(test)]
use std::borrow::Cow;
-use std::convert::TryFrom;
use std::io::{self, BufRead, Cursor, Read, Seek};
-use std::iter::Iterator;
use std::marker::PhantomData;
use std::num::{ParseFloatError, ParseIntError};
use std::path::Path;
@@ -1021,7 +1019,6 @@ pub fn read_raw_file>(path: P) -> ::std::io::Result>
#[cfg(test)]
mod test {
use super::*;
- use std::io::Cursor;
#[test]
fn dimension_overflow() {
diff --git a/src/codecs/ico/decoder.rs b/src/codecs/ico/decoder.rs
index 4f027870f8..699e6a992b 100644
--- a/src/codecs/ico/decoder.rs
+++ b/src/codecs/ico/decoder.rs
@@ -1,5 +1,4 @@
use byteorder::{LittleEndian, ReadBytesExt};
-use std::convert::TryFrom;
use std::io::{self, Cursor, Read, Seek, SeekFrom};
use std::marker::PhantomData;
use std::{error, fmt, mem};
diff --git a/src/codecs/jpeg/decoder.rs b/src/codecs/jpeg/decoder.rs
index a7a4025246..639c6244b7 100644
--- a/src/codecs/jpeg/decoder.rs
+++ b/src/codecs/jpeg/decoder.rs
@@ -1,4 +1,3 @@
-use std::convert::TryFrom;
use std::io::{self, Cursor, Read};
use std::marker::PhantomData;
use std::mem;
diff --git a/src/codecs/jpeg/encoder.rs b/src/codecs/jpeg/encoder.rs
index 21f12a13b4..b350595f6f 100644
--- a/src/codecs/jpeg/encoder.rs
+++ b/src/codecs/jpeg/encoder.rs
@@ -1,7 +1,6 @@
#![allow(clippy::too_many_arguments)]
use std::borrow::Cow;
-use std::convert::TryFrom;
use std::io::{self, Write};
use crate::error::{
diff --git a/src/codecs/png.rs b/src/codecs/png.rs
index d2d0bf6898..0e60f35252 100644
--- a/src/codecs/png.rs
+++ b/src/codecs/png.rs
@@ -6,7 +6,6 @@
//! * - The PNG Specification
//!
-use std::convert::TryFrom;
use std::fmt;
use std::io::{self, Read, Write};
@@ -790,10 +789,9 @@ impl std::error::Error for BadPngRepresentation {}
#[cfg(test)]
mod tests {
use super::*;
- use crate::image::ImageDecoder;
use crate::ImageOutputFormat;
- use std::io::{Cursor, Read};
+ use std::io::Cursor;
#[test]
fn ensure_no_decoder_off_by_one() {
diff --git a/src/codecs/pnm/decoder.rs b/src/codecs/pnm/decoder.rs
index 9105662269..470bc43d67 100644
--- a/src/codecs/pnm/decoder.rs
+++ b/src/codecs/pnm/decoder.rs
@@ -1,5 +1,3 @@
-use std::convert::TryFrom;
-use std::convert::TryInto;
use std::error;
use std::fmt::{self, Display};
use std::io::{self, BufRead, Cursor, Read};
diff --git a/src/codecs/tga/decoder.rs b/src/codecs/tga/decoder.rs
index f4fbf471ec..4bc16c2c8e 100644
--- a/src/codecs/tga/decoder.rs
+++ b/src/codecs/tga/decoder.rs
@@ -8,7 +8,6 @@ use crate::{
};
use byteorder::ReadBytesExt;
use std::{
- convert::TryFrom,
io::{self, Read, Seek},
mem,
};
diff --git a/src/codecs/tga/encoder.rs b/src/codecs/tga/encoder.rs
index 171dde7e30..0bd415b38d 100644
--- a/src/codecs/tga/encoder.rs
+++ b/src/codecs/tga/encoder.rs
@@ -3,7 +3,7 @@ use crate::{
codecs::tga::header::ImageType, error::EncodingError, ColorType, ImageEncoder, ImageError,
ImageFormat, ImageResult,
};
-use std::{convert::TryFrom, error, fmt, io::Write};
+use std::{error, fmt, io::Write};
/// Errors that can occur during encoding and saving of a TGA image.
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
diff --git a/src/codecs/tiff.rs b/src/codecs/tiff.rs
index fd7dca74dc..ab7091f37a 100644
--- a/src/codecs/tiff.rs
+++ b/src/codecs/tiff.rs
@@ -8,7 +8,6 @@
extern crate tiff;
-use std::convert::TryFrom;
use std::io::{self, Cursor, Read, Seek, Write};
use std::marker::PhantomData;
use std::mem;
diff --git a/src/codecs/webp/decoder.rs b/src/codecs/webp/decoder.rs
index 9120290e9d..e590aeeead 100644
--- a/src/codecs/webp/decoder.rs
+++ b/src/codecs/webp/decoder.rs
@@ -1,5 +1,4 @@
use byteorder::{LittleEndian, ReadBytesExt};
-use std::convert::TryFrom;
use std::io::{self, Cursor, Error, Read};
use std::marker::PhantomData;
use std::{error, fmt, mem};
diff --git a/src/codecs/webp/encoder.rs b/src/codecs/webp/encoder.rs
index 4f809f901e..d641f86bf4 100644
--- a/src/codecs/webp/encoder.rs
+++ b/src/codecs/webp/encoder.rs
@@ -5,7 +5,6 @@ use std::collections::BinaryHeap;
///
/// [libwebp]: https://developers.google.com/speed/webp/docs/api#simple_encoding_api
use std::io::{self, Write};
-use std::iter::FromIterator;
use std::slice::ChunksExact;
#[cfg(feature = "webp-encoder")]
diff --git a/src/codecs/webp/extended.rs b/src/codecs/webp/extended.rs
index b9fed0b9fc..eac5b9c052 100644
--- a/src/codecs/webp/extended.rs
+++ b/src/codecs/webp/extended.rs
@@ -1,4 +1,3 @@
-use std::convert::TryInto;
use std::io::{self, Cursor, Error, Read, Seek};
use std::{error, fmt};
diff --git a/src/codecs/webp/huffman.rs b/src/codecs/webp/huffman.rs
index e4e85e7a59..d3b1085cde 100644
--- a/src/codecs/webp/huffman.rs
+++ b/src/codecs/webp/huffman.rs
@@ -1,5 +1,3 @@
-use std::convert::TryInto;
-
use super::lossless::BitReader;
use super::lossless::DecoderError;
use crate::ImageResult;
diff --git a/src/codecs/webp/lossless.rs b/src/codecs/webp/lossless.rs
index c26ef220fb..2ba5e87454 100644
--- a/src/codecs/webp/lossless.rs
+++ b/src/codecs/webp/lossless.rs
@@ -4,8 +4,6 @@
//!
use std::{
- convert::TryFrom,
- convert::TryInto,
error, fmt,
io::Read,
ops::{AddAssign, Shl},
diff --git a/src/codecs/webp/lossless_transform.rs b/src/codecs/webp/lossless_transform.rs
index f9a82c1c89..4d1048961c 100644
--- a/src/codecs/webp/lossless_transform.rs
+++ b/src/codecs/webp/lossless_transform.rs
@@ -1,6 +1,3 @@
-use std::convert::TryFrom;
-use std::convert::TryInto;
-
use super::lossless::subsample_size;
use super::lossless::DecoderError;
diff --git a/src/codecs/webp/vp8.rs b/src/codecs/webp/vp8.rs
index bebd1d1d49..a2a4e58b4d 100644
--- a/src/codecs/webp/vp8.rs
+++ b/src/codecs/webp/vp8.rs
@@ -13,7 +13,6 @@
//!
use byteorder::{LittleEndian, ReadBytesExt};
-use std::convert::TryInto;
use std::default::Default;
use std::io::Read;
use std::{cmp, error, fmt};
diff --git a/src/image.rs b/src/image.rs
index 7648850cf6..738ad41258 100644
--- a/src/image.rs
+++ b/src/image.rs
@@ -1,5 +1,4 @@
#![allow(clippy::too_many_arguments)]
-use std::convert::TryFrom;
use std::ffi::OsStr;
use std::io;
use std::io::Read;
diff --git a/src/imageops/colorops.rs b/src/imageops/colorops.rs
index 6d81cb6a60..67d969d6de 100644
--- a/src/imageops/colorops.rs
+++ b/src/imageops/colorops.rs
@@ -545,7 +545,7 @@ where
mod test {
use super::*;
- use crate::{GrayImage, ImageBuffer};
+ use crate::GrayImage;
macro_rules! assert_pixels_eq {
($actual:expr, $expected:expr) => {{
diff --git a/src/io/mod.rs b/src/io/mod.rs
index 2c48a948ee..80c4fa3884 100644
--- a/src/io/mod.rs
+++ b/src/io/mod.rs
@@ -1,7 +1,5 @@
//! Input and output of images.
-use std::convert::TryFrom;
-
use crate::{error, ColorType, ImageError, ImageResult};
pub(crate) mod free_functions;
diff --git a/tests/reference_images.rs b/tests/reference_images.rs
index 015d6a6e09..406c3e5c71 100644
--- a/tests/reference_images.rs
+++ b/tests/reference_images.rs
@@ -1,5 +1,4 @@
//! Compares the decoding results with reference renderings.
-use std::convert::TryInto;
use std::fs;
use std::io;
use std::path::PathBuf;