Use ..= for inclusive range pattern.

This commit is contained in:
KAMADA Ken'ichi 2019-10-21 23:25:32 +09:00
parent f81d2f6e6a
commit 766822c791
4 changed files with 5 additions and 5 deletions

View File

@ -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(),
}
}

View File

@ -79,7 +79,7 @@ fn get_exif_attr_sub<R>(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")),
_ => {},

View File

@ -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)?,
}
}

View File

@ -441,13 +441,13 @@ fn write_ifd_and_fields<W, E>(
}
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,
};
}