From 766822c7918c87ee5e072b70b2065e80966ffeb9 Mon Sep 17 00:00:00 2001 From: KAMADA Ken'ichi Date: Mon, 21 Oct 2019 23:25:32 +0900 Subject: [PATCH] Use ..= for inclusive range pattern. --- examples/dumpexif.rs | 2 +- src/jpeg.rs | 2 +- src/tag.rs | 2 +- src/writer.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/dumpexif.rs b/examples/dumpexif.rs index 697f569..0a88e5e 100644 --- a/examples/dumpexif.rs +++ b/examples/dumpexif.rs @@ -64,7 +64,7 @@ fn escape(bytes: &&[u8]) -> String { for &c in *bytes { match c { b'\\' | b'"' => write!(buf, "\\{}", c as char).unwrap(), - 0x20...0x7e => buf.write_char(c as char).unwrap(), + 0x20..=0x7e => buf.write_char(c as char).unwrap(), _ => write!(buf, "\\x{:02x}", c).unwrap(), } } diff --git a/src/jpeg.rs b/src/jpeg.rs index 0138d6f..f50b959 100644 --- a/src/jpeg.rs +++ b/src/jpeg.rs @@ -79,7 +79,7 @@ fn get_exif_attr_sub(reader: &mut R) } // Continue or return early on stand-alone markers. match code { - marker::Z | marker::TEM | marker::RST0...marker::RST7 => continue, + marker::Z | marker::TEM | marker::RST0..=marker::RST7 => continue, marker::SOI => return Err(Error::InvalidFormat("Unexpected SOI")), marker::EOI => return Err(Error::NotFound("No Exif data found")), _ => {}, diff --git a/src/tag.rs b/src/tag.rs index 139dc99..3af3e12 100644 --- a/src/tag.rs +++ b/src/tag.rs @@ -1493,7 +1493,7 @@ fn d_sub_ascii(w: &mut fmt::Write, bytes: &[u8]) -> fmt::Result { w.write_char('\\')?; w.write_char(c as char)?; }, - 0x20...0x7e => w.write_char(c as char)?, + 0x20..=0x7e => w.write_char(c as char)?, _ => write!(w, "\\x{:02x}", c)?, } } diff --git a/src/writer.rs b/src/writer.rs index f48f630..4f87b0c 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -441,13 +441,13 @@ fn write_ifd_and_fields( } if f.tag == Tag::StripOffsets { strip_offsets_offset = match valbuf.len() { - 0...4 => ifd_offset + ifd.len() as u32 - 4, + 0..=4 => ifd_offset + ifd.len() as u32 - 4, _ => get_offset(w)? - valbuf.len() as u32, }; } if f.tag == Tag::TileOffsets { tile_offsets_offset = match valbuf.len() { - 0...4 => ifd_offset + ifd.len() as u32 - 4, + 0..=4 => ifd_offset + ifd.len() as u32 - 4, _ => get_offset(w)? - valbuf.len() as u32, }; }