Skip to content

Commit 63ded3d

Browse files
committed
Remove unused libc dependency and minimal failure dependency.
Failure is replaced with finalfusion's error handling.
1 parent 2fbfeae commit 63ded3d

File tree

3 files changed

+3
-75
lines changed

3 files changed

+3
-75
lines changed

Cargo.lock

Lines changed: 0 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ features = ["extension-module"]
2020

2121
[dependencies]
2222
itertools = "0.8"
23-
failure = "0.1"
2423
finalfusion = { git = "https://github.com/finalfusion/finalfusion-rust", rev = "66388fe0e46c45d009ffdb8342c76fcb8c9c64d3"}
25-
libc = "0.2"
2624
ndarray = "0.12"
2725
numpy = "0.7"
2826
toml = "0.5"

src/embeddings.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::fs::File;
44
use std::io::{BufReader, BufWriter};
55
use std::rc::Rc;
66

7-
use failure::Error;
87
use finalfusion::chunks::metadata::Metadata;
98
use finalfusion::compat::text::{ReadText, ReadTextDims};
109
use finalfusion::compat::word2vec::ReadWord2Vec;
@@ -373,11 +372,12 @@ impl PyIterProtocol for PyEmbeddings {
373372
}
374373
}
375374

376-
fn read_embeddings<S>(path: &str, mmap: bool) -> Result<Embeddings<VocabWrap, S>, Error>
375+
fn read_embeddings<S>(path: &str, mmap: bool) -> Result<Embeddings<VocabWrap, S>, ffio::Error>
377376
where
378377
Embeddings<VocabWrap, S>: ReadEmbeddings + MmapEmbeddings,
379378
{
380-
let f = File::open(path)?;
379+
let f = File::open(path)
380+
.map_err(|e| ffio::ErrorKind::io_error("Cannot open embeddings file for reading", e))?;
381381
let mut reader = BufReader::new(f);
382382

383383
let embeddings = if mmap {

0 commit comments

Comments
 (0)