Skip to content

Commit

Permalink
Fix some deprecation warnings
Browse files Browse the repository at this point in the history
* Update to new range/slice syntax
* `Show` renamed to `Debug`
  • Loading branch information
mbrubeck committed Jan 23, 2015
1 parent ff78b2f commit 1aff46f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,7 @@ where Container: ArrayLike<T>, T: Primitive + 'static, PixelType: Pixel<T> + 'st
let index = no_channels * (y * self.width + x) as usize;
Pixel::from_slice(
None::<&PixelType>,
self.data.as_slice().slice(
index, index + no_channels
)
&self.data.as_slice()[index .. index + no_channels]
)
}

Expand All @@ -350,9 +348,7 @@ where Container: ArrayLike<T>, T: Primitive + 'static, PixelType: Pixel<T> + 'st
let index = no_channels * (y * self.width + x) as usize;
Pixel::from_slice_mut(
None::<&PixelType>,
self.data.as_mut_slice().slice_mut(
index, index + no_channels
)
&mut self.data.as_mut_slice()[index .. index + no_channels]
)
}

Expand Down Expand Up @@ -511,7 +507,7 @@ impl GreyImage {
// Aquire a second view into the buffer
let indicies = unsafe {
let view: &mut [u8] = mem::transmute_copy(&data.as_mut_slice());
view.slice_to(entries)
&view[.. entries]
};
let mut buffer = ImageBuffer::from_vec(width, height, data).unwrap();
for (pixel, &idx) in buffer.pixels_mut().rev().zip(indicies.iter().rev()) {
Expand Down
2 changes: 1 addition & 1 deletion src/tiff/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ impl<R: Reader + Seek> TIFFDecoder<R> {
try!(reader.read(&mut buffer[..length as usize]))
}
(color::ColorType::RGB(8), DecodingBuffer::U8(ref mut buffer)) => {
try!(reader.read(buffer.slice_to_mut(length as usize)))
try!(reader.read(&mut buffer[..length as usize]))
}
(type_, _) => return Err(::image::ImageError::UnsupportedError(format!(
"Color type {:?} is unsupported", type_
Expand Down
2 changes: 1 addition & 1 deletion src/tiff/ifd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub struct Entry {
offset: [u8; 4],
}

impl ::std::fmt::Show for Entry {
impl ::std::fmt::Debug for Entry {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
fmt.write_str(&format!("Entry {{ type_: {:?}, count: {:?}, offset: {:?} }}",
self.type_,
Expand Down

0 comments on commit 1aff46f

Please sign in to comment.