Skip to content

Commit dbde81e

Browse files
rylevMark-Simulacrum
authored andcommitted
Update snap to 1.0
1 parent cd77ab6 commit dbde81e

File tree

5 files changed

+13
-33
lines changed

5 files changed

+13
-33
lines changed

Cargo.lock

+2-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

collector/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ xz2 = "0.1.3"
2323
tar = "0.4"
2424
crossbeam-channel = "0.3.8"
2525
bincode = "1"
26-
snap = "0.2.5"
26+
snap = "1.0"
2727
hashbrown = "0.7.0"
2828
bumpalo = "3.2"
2929

collector/src/bin/recode.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1414
if filename.starts_with("commit-") && filename.ends_with(".sz") {
1515
eprintln!("{:?}", filename);
1616
use std::io::Read;
17-
let mut out = String::with_capacity(snap::decompress_len(&file_contents).unwrap_or(0));
18-
let mut szip_reader = snap::Reader::new(&file_contents[..]);
17+
let mut out =
18+
String::with_capacity(snap::raw::decompress_len(&file_contents).unwrap_or(0));
19+
let mut szip_reader = snap::read::FrameDecoder::new(&file_contents[..]);
1920
szip_reader.read_to_string(&mut out).unwrap();
2021
let file_contents = out.as_str();
2122

@@ -26,7 +27,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2627
continue;
2728
}
2829
};
29-
let mut v = snap::Writer::new(Vec::new());
30+
let mut v = snap::write::FrameEncoder::new(Vec::new());
3031
serde_json::to_writer(&mut v, &contents)?;
3132
fs::write(entry.path(), v.into_inner()?)?;
3233
}

collector/src/bin/rustc-perf-collector/outrepo.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ impl Repo {
6666
}
6767

6868
pub fn open(path: PathBuf, allow_new_dir: bool, use_remote: bool) -> anyhow::Result<Self> {
69-
let result = Repo {
70-
path: path,
71-
use_remote,
72-
};
69+
let result = Repo { path, use_remote };
7370

7471
// Don't nuke random repositories, unless specifically requested.
7572
if !allow_new_dir && !result.perf_file().exists() {
@@ -126,8 +123,8 @@ impl Repo {
126123
let c;
127124
let contents = if filepath.to_str().map_or(false, |s| s.ends_with(".sz")) {
128125
use std::io::Read;
129-
let mut out = Vec::with_capacity(snap::decompress_len(&contents).unwrap_or(0));
130-
let mut szip_reader = snap::Reader::new(&contents[..]);
126+
let mut out = Vec::with_capacity(snap::raw::decompress_len(&contents).unwrap_or(0));
127+
let mut szip_reader = snap::read::FrameDecoder::new(&contents[..]);
131128
szip_reader.read_to_end(&mut out).unwrap();
132129
c = out;
133130
&c
@@ -168,7 +165,7 @@ impl Repo {
168165
commit.sha
169166
));
170167
info!("creating file {}", filepath.display());
171-
let mut v = snap::Writer::new(Vec::new());
168+
let mut v = snap::write::FrameEncoder::new(Vec::new());
172169
serde_json::to_writer(&mut v, &data)?;
173170
fs::write(&filepath, v.into_inner()?)?;
174171
Ok(())

collector/src/lib.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -237,19 +237,11 @@ pub enum BenchmarkState {
237237

238238
impl BenchmarkState {
239239
pub fn is_base_compile(&self) -> bool {
240-
if let BenchmarkState::Clean = *self {
241-
true
242-
} else {
243-
false
244-
}
240+
matches!(*self, BenchmarkState::Clean)
245241
}
246242

247243
pub fn is_patch(&self) -> bool {
248-
if let BenchmarkState::IncrementalPatched(_) = *self {
249-
true
250-
} else {
251-
false
252-
}
244+
matches!(*self, BenchmarkState::IncrementalPatched(_))
253245
}
254246

255247
pub fn name(&self) -> Cow<'static, str> {

0 commit comments

Comments
 (0)