Makes Clippy happy

pull/278/head
Tpt 2 years ago committed by Thomas Tanon
parent ffa16b3afd
commit 7a259955d2
  1. 4
      js/src/model.rs
  2. 14
      lib/benches/store.rs
  3. 16
      lib/tests/store.rs

@ -712,7 +712,7 @@ impl FromJsConverter {
.map_err(|v| UriError::new(&v.to_string()))?
.into()),
"BlankNode" => Ok(BlankNode::new(
&Reflect::get(value, &self.value)?
Reflect::get(value, &self.value)?
.as_string()
.ok_or_else(|| format_err!("BlankNode should have a string value"))?,
)
@ -741,7 +741,7 @@ impl FromJsConverter {
}
"DefaultGraph" => Ok(JsTerm::DefaultGraph(JsDefaultGraph {})),
"Variable" => Ok(Variable::new(
&Reflect::get(value, &self.value)?
Reflect::get(value, &self.value)?
.as_string()
.ok_or_else(|| format_err!("Variable should have a string value"))?,
)

@ -29,14 +29,14 @@ fn store_load(c: &mut Criterion) {
group.bench_function("load BSBM explore 1000 in on disk", |b| {
b.iter(|| {
let path = TempDir::default();
let store = Store::open(&path.0).unwrap();
let store = Store::open(&path).unwrap();
do_load(&store, &data);
})
});
group.bench_function("load BSBM explore 1000 in on disk with bulk load", |b| {
b.iter(|| {
let path = TempDir::default();
let store = Store::open(&path.0).unwrap();
let store = Store::open(&path).unwrap();
do_bulk_load(&store, &data);
})
});
@ -54,7 +54,7 @@ fn store_load(c: &mut Criterion) {
group.bench_function("load BSBM explore 10000 in on disk with bulk load", |b| {
b.iter(|| {
let path = TempDir::default();
let store = Store::open(&path.0).unwrap();
let store = Store::open(&path).unwrap();
do_bulk_load(&store, &data);
})
});
@ -129,7 +129,7 @@ fn store_query_and_update(c: &mut Criterion) {
{
let path = TempDir::default();
let disk_store = Store::open(&path.0).unwrap();
let disk_store = Store::open(&path).unwrap();
do_bulk_load(&disk_store, &data);
group.bench_function("BSBM explore 1000 query on disk", |b| {
b.iter(|| run_operation(&disk_store, &query_operations))
@ -201,6 +201,12 @@ impl Default for TempDir {
}
}
impl AsRef<Path> for TempDir {
fn as_ref(&self) -> &Path {
&self.0
}
}
impl Drop for TempDir {
fn drop(&mut self) {
remove_dir_all(&self.0).unwrap()

@ -8,7 +8,7 @@ use std::error::Error;
use std::fs::{create_dir, remove_dir_all, File};
use std::io::{Cursor, Write};
use std::iter::once;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::process::Command;
const DATA: &str = r#"
@ -301,9 +301,9 @@ fn test_backup() -> Result<(), Box<dyn Error>> {
let store_dir = TempDir::default();
let backup_dir = TempDir::default();
let store = Store::open(&store_dir.0)?;
let store = Store::open(&store_dir)?;
store.insert(quad)?;
store.backup(&backup_dir.0)?;
store.backup(&backup_dir)?;
store.remove(quad)?;
assert!(!store.contains(quad)?);
@ -319,14 +319,14 @@ fn test_bad_backup() -> Result<(), Box<dyn Error>> {
let backup_dir = TempDir::default();
create_dir(&backup_dir.0)?;
assert!(Store::open(&store_dir.0)?.backup(&backup_dir.0).is_err());
assert!(Store::open(&store_dir)?.backup(&backup_dir.0).is_err());
Ok(())
}
#[test]
fn test_backup_on_in_memory() -> Result<(), Box<dyn Error>> {
let backup_dir = TempDir::default();
assert!(Store::new()?.backup(&backup_dir.0).is_err());
assert!(Store::new()?.backup(&backup_dir).is_err());
Ok(())
}
@ -374,6 +374,12 @@ impl Default for TempDir {
}
}
impl AsRef<Path> for TempDir {
fn as_ref(&self) -> &Path {
&self.0
}
}
impl Drop for TempDir {
fn drop(&mut self) {
let _ = remove_dir_all(&self.0);

Loading…
Cancel
Save