Skip to content

Commit

Permalink
remove usage of drop_bomb
Browse files Browse the repository at this point in the history
  • Loading branch information
trinity-1686a committed Sep 4, 2019
1 parent fb27a6a commit 1911b48
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ murmurhash32 = "0.2"
chrono = "0.4"
smallvec = "0.6"

drop_bomb = "0.1.4"

[target.'cfg(windows)'.dependencies]
winapi = "0.3"

Expand Down
5 changes: 1 addition & 4 deletions src/directory/managed_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,13 @@ struct FooterProxy<W: TerminatingWrite> {
hasher: Option<Hasher>,
/// always Some except after terminate call
writer: Option<W>,
bomb: drop_bomb::DropBomb,
}

impl<W: TerminatingWrite> FooterProxy<W> {
fn new(writer: W) -> Self {
FooterProxy {
hasher: Some(Hasher::new()),
writer: Some(writer),
bomb: drop_bomb::DropBomb::new("This must be terminated before dropping"),
}
}
}
Expand All @@ -370,9 +368,8 @@ impl<W: TerminatingWrite> Write for FooterProxy<W> {

impl<W: TerminatingWrite> TerminatingWrite for FooterProxy<W> {
fn terminate_ref(&mut self, _: AntiCallToken) -> io::Result<()> {
self.bomb.defuse();
let crc = self.hasher.take().unwrap().finalize();
let footer = V0::from_crc(crc).to_bytes();
let footer = Footer::V0(V0::from_crc(crc)).to_bytes();
let mut writer = self.writer.take().unwrap();
writer.write_all(&footer)?;
writer.flush()?;//should we assume calling terminate on inner already flush?
Expand Down

0 comments on commit 1911b48

Please sign in to comment.