Skip to content

Commit

Permalink
Remove usage of the core feature
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Mar 9, 2015
1 parent cf869fa commit 04555a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions src/gz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::io::prelude::*;
use std::io;
use std::iter::repeat;
use std::mem;
use std::slice::bytes;

use Compression;
use crc::{CrcReader, Crc};
Expand Down Expand Up @@ -144,7 +143,7 @@ impl Builder {
flg |= FEXTRA;
header.push((v.len() >> 0) as u8);
header.push((v.len() >> 8) as u8);
header.push_all(v.as_slice());
header.push_all(&v);
}
None => {}
}
Expand Down Expand Up @@ -284,7 +283,9 @@ impl<R: Read> EncoderReader<R> {

fn copy(into: &mut [u8], from: &[u8], pos: &mut usize) -> usize {
let min = cmp::min(into.len(), from.len() - *pos);
bytes::copy_memory(into, &from[*pos .. *pos + min]);
for (slot, val) in into.iter_mut().zip(from[*pos..*pos + min].iter()) {
*slot = *val;
}
*pos += min;
return min
}
Expand Down Expand Up @@ -450,15 +451,15 @@ impl<R: Read> Read for DecoderReader<R> {
impl Header {
/// Returns the `filename` field of this gzip stream's header, if present.
pub fn filename(&self) -> Option<&[u8]> {
self.filename.as_ref().map(|s| s.as_slice())
self.filename.as_ref().map(|s| &s[..])
}
/// Returns the `extra` field of this gzip stream's header, if present.
pub fn extra(&self) -> Option<&[u8]> {
self.extra.as_ref().map(|s| s.as_slice())
self.extra.as_ref().map(|s| &s[..])
}
/// Returns the `comment` field of this gzip stream's header, if present.
pub fn comment(&self) -> Option<&[u8]> {
self.comment.as_ref().map(|s| s.as_slice())
self.comment.as_ref().map(|s| &s[..])
}
/// Returns the `mtime` field of this gzip stream's header, if present.
pub fn mtime(&self) -> u32 { self.mtime }
Expand Down Expand Up @@ -494,7 +495,7 @@ mod tests {
let mut real = Vec::new();
let mut w = EncoderWriter::new(Vec::new(), Default);
let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>();
for _ in range(0, 200) {
for _ in 0..200 {
let to_write = &v[..thread_rng().gen_range(0, v.len())];
real.push_all(to_write);
w.write_all(to_write).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//! already existing stream to chain construction.
#![doc(html_root_url = "http://alexcrichton.com/flate2-rs")]
#![feature(io, core, collections)]
#![feature(io, collections)]
#![deny(missing_docs)]
#![feature(unsafe_destructor)]
#![cfg_attr(test, deny(warnings))]
Expand Down
2 changes: 1 addition & 1 deletion src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum Flush {
}

#[doc(hidden)]
pub trait Direction: marker::MarkerTrait {
pub trait Direction: marker::PhantomFn<Self> {
unsafe fn destroy(stream: *mut ffi::mz_stream) -> c_int;
}

Expand Down

0 comments on commit 04555a3

Please sign in to comment.