Run 'cargo fix' for rust-2018

With this patch we move the codebase to Rust-2018.

The diff was generated by executing

    cargo fix --all --all-features --edition

on the codebase.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-02-28 17:28:32 +01:00
parent 51daf28509
commit 1d89844613
105 changed files with 295 additions and 295 deletions

View file

@ -97,7 +97,7 @@ fn main() {
fn add(rt: &Runtime) {
let scmd = rt.cli().subcommand_matches("add").unwrap(); // safed by main()
let mut ids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap().into_iter();
let mut ids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap().into_iter();
if let Some(first) = ids.next() {
let mut annotation = rt.store()
@ -144,7 +144,7 @@ fn remove(rt: &Runtime) {
let scmd = rt.cli().subcommand_matches("remove").unwrap(); // safed by main()
let annotation_name = scmd.value_of("annotation_name").unwrap(); // safed by clap
let delete = scmd.is_present("delete-annotation");
let ids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let ids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
ids.into_iter().for_each(|id| {
let mut entry = rt.store()
@ -181,7 +181,7 @@ fn remove(rt: &Runtime) {
fn list(rt: &Runtime) {
let scmd = rt.cli().subcommand_matches("list").unwrap(); // safed by clap
let with_text = scmd.is_present("list-with-text");
let ids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let ids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
if ids.len() != 0 {
let _ = ids

View file

@ -92,7 +92,7 @@ fn main() {
fn set(rt: &Runtime) {
let scmd = rt.cli().subcommand_matches("set").unwrap(); // safed by main()
let name = scmd.value_of("set-name").map(String::from).unwrap(); // safed by clap
let sids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let sids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
StoreIdIterator::new(Box::new(sids.into_iter().map(Ok)))
.into_get_iter(rt.store())
@ -109,7 +109,7 @@ fn set(rt: &Runtime) {
}
fn get(rt: &Runtime) {
let sids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let sids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
let out = rt.stdout();
let mut outlock = out.lock();

View file

@ -63,7 +63,7 @@ fn main() {
let edit_header = rt.cli().is_present("edit-header");
let edit_header_only = rt.cli().is_present("edit-header-only");
let sids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let sids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
StoreIdIterator::new(Box::new(sids.into_iter().map(Ok)))
.into_get_iter(rt.store())

View file

@ -124,7 +124,7 @@ fn add(rt: &Runtime) {
Coordinates::new(long, lati)
};
rt.ids::<::ui::PathProvider>()
rt.ids::<crate::ui::PathProvider>()
.map_err_trace_exit_unwrap()
.into_iter()
.for_each(|id| {
@ -149,7 +149,7 @@ fn remove(rt: &Runtime) {
.unwrap()
.is_present("print-removed"); // safed by main()
rt.ids::<::ui::PathProvider>()
rt.ids::<crate::ui::PathProvider>()
.map_err_trace_exit_unwrap()
.into_iter()
.for_each(|id| {
@ -179,7 +179,7 @@ fn remove(rt: &Runtime) {
fn get(rt: &Runtime) {
let mut stdout = rt.stdout();
rt.ids::<::ui::PathProvider>()
rt.ids::<crate::ui::PathProvider>()
.map_err_trace_exit_unwrap()
.into_iter()
.for_each(|id| {

View file

@ -79,7 +79,7 @@ fn main() {
trace!("list_output_with_ids = {:?}", list_output_with_ids );
trace!("list_output_with_ids_fmt = {:?}", list_output_with_ids_fmt);
let sids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let sids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
let iter = StoreIdIterator::new(Box::new(sids.into_iter().map(Ok)))
.into_get_iter(rt.store())

View file

@ -65,8 +65,8 @@ use libimagerror::io::ToExitCode;
mod id_filters;
mod ui;
use ui::build_ui;
use id_filters::IsInCollectionsFilter;
use crate::ui::build_ui;
use crate::id_filters::IsInCollectionsFilter;
fn main() {
let version = make_imag_version!();
@ -93,7 +93,7 @@ fn main() {
let iterator = if rt.ids_from_stdin() {
debug!("Fetching IDs from stdin...");
let ids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let ids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
Box::new(ids.into_iter().map(Ok))
as Box<Iterator<Item = Result<StoreId, _>>>
} else {

View file

@ -79,7 +79,7 @@ use failure::Fallible as Result;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
fn main() {
let version = make_imag_version!();
@ -209,7 +209,7 @@ fn remove_linking(rt: &Runtime) {
})
.unwrap();
rt.ids::<::ui::PathProvider>()
rt.ids::<crate::ui::PathProvider>()
.map_err_trace_exit_unwrap()
.into_iter()
.for_each(|id| match rt.store().get(id.clone()) {
@ -245,7 +245,7 @@ fn remove_linking(rt: &Runtime) {
}
fn unlink(rt: &Runtime) {
rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap().into_iter().for_each(|id| {
rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap().into_iter().for_each(|id| {
rt.store()
.get(id.clone())
.map_err_trace_exit_unwrap()
@ -271,7 +271,7 @@ fn list_linkings(rt: &Runtime) {
let mut tab = ::prettytable::Table::new();
tab.set_titles(row!["#", "Link"]);
rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap().into_iter().for_each(|id| {
rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap().into_iter().for_each(|id| {
match rt.store().get(id.clone()) {
Ok(Some(entry)) => {
for (i, link) in entry.get_internal_links().map_err_trace_exit_unwrap().enumerate() {

View file

@ -45,7 +45,7 @@ extern crate libimagentrylink;
use std::process::exit;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
use std::path::PathBuf;

View file

@ -46,7 +46,7 @@ extern crate libimaginteraction;
extern crate libimagutil;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
use std::process::exit;
use std::io::Write;
@ -92,7 +92,7 @@ fn main() {
fn deref(rt: &Runtime) {
let cmd = rt.cli().subcommand_matches("deref").unwrap();
let basepath = cmd.value_of("override-basepath");
let ids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let ids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
let cfg = get_ref_config(&rt, "imag-ref").map_err_trace_exit_unwrap();
let out = rt.stdout();
let mut outlock = out.lock();
@ -130,7 +130,7 @@ fn remove(rt: &Runtime) {
let cmd = rt.cli().subcommand_matches("remove").unwrap();
let yes = cmd.is_present("yes");
let ids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let ids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
let mut input = rt.stdin().unwrap_or_else(|| {
error!("No input stream. Cannot ask for permission");
@ -169,7 +169,7 @@ fn list_dead(rt: &Runtime) {
let list_id = cmd.is_present("list-dead-ids");
let mut output = rt.stdout();
rt.ids::<::ui::PathProvider>()
rt.ids::<crate::ui::PathProvider>()
.map_err_trace_exit_unwrap()
.into_iter()
.for_each(|id| {
@ -204,7 +204,7 @@ fn list_dead(rt: &Runtime) {
});
}
fn create(rt: &Runtime) {
fn create(_rt: &Runtime) {
unimplemented!()
}

View file

@ -35,7 +35,7 @@ use libimagerror::trace::MapErrTrace;
use libimagerror::exit::ExitUnwrap;
use libimagutil::debug_result::*;
use util::build_toml_header;
use crate::util::build_toml_header;
pub fn create(rt: &Runtime) {
let scmd = rt.cli().subcommand_matches("create").unwrap();

View file

@ -39,7 +39,7 @@ pub fn delete(rt: &Runtime) {
#[cfg(test)]
mod tests {
use create::create;
use crate::create::create;
use super::delete;
use std::path::PathBuf;

View file

@ -24,7 +24,7 @@ use libimagerror::trace::MapErrTrace;
use libimagerror::exit::ExitUnwrap;
use libimagstore::storeid::StoreId;
use retrieve::print_entry;
use crate::retrieve::print_entry;
pub fn get(rt: &Runtime) {
let scmd = rt.cli().subcommand_matches("get").unwrap();

View file

@ -65,13 +65,13 @@ mod util;
use std::ops::Deref;
use create::create;
use delete::delete;
use get::get;
use retrieve::retrieve;
use ui::build_ui;
use update::update;
use verify::verify;
use crate::create::create;
use crate::delete::delete;
use crate::get::get;
use crate::retrieve::retrieve;
use crate::ui::build_ui;
use crate::update::update;
use crate::verify::verify;
fn main() {
let version = make_imag_version!();

View file

@ -25,7 +25,7 @@ use libimagerror::trace::MapErrTrace;
use libimagerror::exit::ExitUnwrap;
use libimagstore::storeid::StoreId;
use util::build_toml_header;
use crate::util::build_toml_header;
pub fn update(rt: &Runtime) {
let scmd = rt.cli().subcommand_matches("update").unwrap();

View file

@ -75,7 +75,7 @@ use clap::ArgMatches;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
fn main() {
let version = make_imag_version!();
@ -84,7 +84,7 @@ fn main() {
"Direct interface to the store. Use with great care!",
build_ui);
let ids = rt.ids::<::ui::PathProvider>().map_err_trace_exit_unwrap();
let ids = rt.ids::<crate::ui::PathProvider>().map_err_trace_exit_unwrap();
rt.cli()
.subcommand_name()

View file

@ -71,7 +71,7 @@ use libimagstore::iter::get::StoreIdGetIteratorExtension;
use libimagstore::store::FileLockEntry;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
fn main() {
let version = make_imag_version!();
@ -82,7 +82,7 @@ fn main() {
let view_header = rt.cli().is_present("view-header");
let hide_content = rt.cli().is_present("not-view-content");
let entries = rt.ids::<::ui::PathProvider>()
let entries = rt.ids::<crate::ui::PathProvider>()
.map_err_trace_exit_unwrap()
.into_iter()
.map(Ok)

View file

@ -63,7 +63,7 @@ use libimagutil::debug_result::DebugResult;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
fn main() {
let version = make_imag_version!();

View file

@ -68,7 +68,7 @@ pub fn edit(rt: &Runtime) {
exit(1)
});
::util::find_contact_by_hash(rt, hash)
crate::util::find_contact_by_hash(rt, hash)
.for_each(|contact| {
loop {
let res = edit_contact(&rt, &contact, &ref_config, collection_name, force_override);

View file

@ -82,10 +82,10 @@ mod util;
mod create;
mod edit;
use ui::build_ui;
use util::build_data_object_for_handlebars;
use create::create;
use edit::edit;
use crate::ui::build_ui;
use crate::util::build_data_object_for_handlebars;
use crate::create::create;
use crate::edit::edit;
fn main() {
let version = make_imag_version!();

View file

@ -36,9 +36,9 @@ use libimagutil::debug_option::DebugOption;
use libimagstore::store::FileLockEntry;
use libimagstore::store::Store;
use util::get_diary_name;
use util::get_diary_timed_config;
use util::Timed;
use crate::util::get_diary_name;
use crate::util::get_diary_timed_config;
use crate::util::Timed;
pub fn create(rt: &Runtime) {
let diaryname = get_diary_name(rt)
@ -61,7 +61,7 @@ pub fn create(rt: &Runtime) {
}
fn create_entry<'a>(diary: &'a Store, diaryname: &str, rt: &Runtime) -> FileLockEntry<'a> {
use util::parse_timed_string;
use crate::util::parse_timed_string;
let create = rt.cli().subcommand_matches("create").unwrap();

View file

@ -30,7 +30,7 @@ use libimagstore::storeid::IntoStoreId;
use libimagerror::trace::MapErrTrace;
use libimagerror::exit::ExitUnwrap;
use util::get_diary_name;
use crate::util::get_diary_name;
pub fn delete(rt: &Runtime) {
use libimaginteraction::ask::ask_bool;

View file

@ -33,7 +33,7 @@ use libimagstore::storeid::IntoStoreId;
use failure::Fallible as Result;
use util::get_diary_name;
use crate::util::get_diary_name;
pub fn list(rt: &Runtime) {
let diaryname = get_diary_name(rt)

View file

@ -67,10 +67,10 @@ mod ui;
mod util;
mod view;
use create::create;
use delete::delete;
use list::list;
use view::view;
use crate::create::create;
use crate::delete::delete;
use crate::list::list;
use crate::view::view;
fn main() {
let version = make_imag_version!();

View file

@ -27,7 +27,7 @@ use libimagutil::warn_exit::warn_exit;
use libimagstore::iter::get::StoreIdGetIteratorExtension;
use libimagentryview::viewer::Viewer;
use util::get_diary_name;
use crate::util::get_diary_name;
pub fn view(rt: &Runtime) {
let diaryname = get_diary_name(rt).unwrap_or_else(|| warn_exit("No diary name", 1));

View file

@ -71,7 +71,7 @@ use libimagstore::iter::get::StoreIdGetIteratorExtension;
use libimagstore::store::FileLockEntry;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
use toml::Value;
use itertools::Itertools;

View file

@ -71,7 +71,7 @@ use libimagstore::iter::get::StoreIdGetIteratorExtension;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
fn main() {
let version = make_imag_version!();
@ -215,7 +215,7 @@ fn list(rt: &Runtime) {
}
if rt.ids_from_stdin() {
let iter = rt.ids::<::ui::PathProvider>()
let iter = rt.ids::<crate::ui::PathProvider>()
.map_err_trace_exit_unwrap()
.into_iter()
.map(Ok);

View file

@ -65,7 +65,7 @@ use libimagutil::warn_result::WarnResult;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
fn main() {
let version = make_imag_version!();

View file

@ -62,16 +62,16 @@ mod ui;
mod week;
mod year;
use cont::cont;
use day::day;
use list::{list, list_impl};
use month::month;
use start::start;
use stop::stop;
use track::track;
use ui::build_ui;
use week::week;
use year::year;
use crate::cont::cont;
use crate::day::day;
use crate::list::{list, list_impl};
use crate::month::month;
use crate::start::start;
use crate::stop::stop;
use crate::track::track;
use crate::ui::build_ui;
use crate::week::week;
use crate::year::year;
use libimagrt::setup::generate_runtime_setup;
use libimagerror::trace::MapErrTrace;

View file

@ -60,7 +60,7 @@ use libimagerror::io::ToExitCode;
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
fn main() {
let version = make_imag_version!();
let rt = generate_runtime_setup("imag-todo",

View file

@ -44,7 +44,7 @@ use libimagwiki::store::WikiStore;
use libimagentryedit::edit::{Edit, EditHeader};
mod ui;
use ui::build_ui;
use crate::ui::build_ui;
fn main() {
let version = make_imag_version!();

View file

@ -19,7 +19,7 @@
use std::io::ErrorKind;
use exit::ExitCode;
use crate::exit::ExitCode;
pub enum Settings {
Ignore(ErrorKind),
@ -28,7 +28,7 @@ pub enum Settings {
pub trait ToExitCode<T> {
fn to_exit_code(self) -> Result<T, ExitCode>;
fn to_exit_code_with(self, Settings) -> Result<T, ExitCode>;
fn to_exit_code_with(self, _: Settings) -> Result<T, ExitCode>;
}
impl<T> ToExitCode<T> for Result<T, ::std::io::Error> {

View file

@ -62,7 +62,7 @@ impl<I, T> Iterator for UnwrapExit<I, T>
type Item = T;
fn next(&mut self) -> Option<Self::Item> {
use trace::MapErrTrace;
use crate::trace::MapErrTrace;
self.0.next().map(|e| e.map_err_trace_exit_unwrap())
}
}
@ -71,7 +71,7 @@ impl<I, T> DoubleEndedIterator for UnwrapExit<I, T>
where I: DoubleEndedIterator<Item = Result<T, Error>>,
{
fn next_back(&mut self) -> Option<Self::Item> {
use trace::MapErrTrace;
use crate::trace::MapErrTrace;
self.0.next_back().map(|e| e.map_err_trace_exit_unwrap())
}
}

View file

@ -24,7 +24,7 @@ use std::sync::Arc;
use std::sync::Mutex;
use std::ops::Deref;
use runtime::Runtime;
use crate::runtime::Runtime;
use failure::ResultExt;
use failure::Fallible as Result;

View file

@ -37,9 +37,9 @@ use failure::Fallible as Result;
use failure::Error;
use failure::err_msg;
use configuration::{fetch_config, override_config, InternalConfiguration};
use logger::ImagLogger;
use io::OutputProxy;
use crate::configuration::{fetch_config, override_config, InternalConfiguration};
use crate::logger::ImagLogger;
use crate::io::OutputProxy;
use libimagerror::exit::ExitCode;
use libimagerror::errors::ErrorMsg as EM;
@ -48,7 +48,7 @@ use libimagerror::io::ToExitCode;
use libimagstore::store::Store;
use libimagstore::storeid::StoreId;
use libimagutil::debug_result::DebugResult;
use spec::CliSpec;
use crate::spec::CliSpec;
use atty;
/// The Runtime object

View file

@ -19,7 +19,7 @@
use clap::App;
use runtime::Runtime;
use crate::runtime::Runtime;
pub type Name = &'static str;
pub type Version<'a> = &'a str;

View file

@ -45,7 +45,7 @@ pub fn config_implicit_store_create_allowed(config: &Option<Value>) -> Result<bo
#[cfg(test)]
mod tests {
use toml::de::from_str as toml_from_str;
use configuration::*;
use crate::configuration::*;
#[test]
fn test_implicit_store_create_allowed_no_toml() {

View file

@ -27,10 +27,10 @@ use libimagerror::errors::ErrorMsg as EM;
use super::FileAbstraction;
use super::FileAbstractionInstance;
use super::Drain;
use store::Entry;
use storeid::StoreIdWithBase;
use file_abstraction::iter::PathIterator;
use file_abstraction::iter::PathIterBuilder;
use crate::store::Entry;
use crate::storeid::StoreIdWithBase;
use crate::file_abstraction::iter::PathIterator;
use crate::file_abstraction::iter::PathIterBuilder;
use walkdir::WalkDir;
use failure::ResultExt;

View file

@ -32,10 +32,10 @@ use failure::Error;
use super::FileAbstraction;
use super::FileAbstractionInstance;
use super::Drain;
use store::Entry;
use storeid::StoreIdWithBase;
use file_abstraction::iter::PathIterator;
use file_abstraction::iter::PathIterBuilder;
use crate::store::Entry;
use crate::storeid::StoreIdWithBase;
use crate::file_abstraction::iter::PathIterator;
use crate::file_abstraction::iter::PathIterBuilder;
type Backend = Arc<Mutex<RefCell<HashMap<PathBuf, Entry>>>>;

View file

@ -23,8 +23,8 @@ use std::fmt::Debug;
use failure::Fallible as Result;
use storeid::StoreIdWithBase;
use file_abstraction::FileAbstraction;
use crate::storeid::StoreIdWithBase;
use crate::file_abstraction::FileAbstraction;
/// See documentation for PathIterator
pub(crate) trait PathIterBuilder : Debug {

View file

@ -24,8 +24,8 @@ use std::sync::Arc;
use failure::Fallible as Result;
use store::Entry;
use storeid::StoreIdWithBase;
use crate::store::Entry;
use crate::storeid::StoreIdWithBase;
pub mod fs;
pub mod inmemory;
@ -40,8 +40,8 @@ pub(crate) trait FileAbstraction : Debug {
fn rename(&self, from: &PathBuf, to: &PathBuf) -> Result<()>;
fn create_dir_all(&self, _: &PathBuf) -> Result<()>;
fn exists(&self, &PathBuf) -> Result<bool>;
fn is_file(&self, &PathBuf) -> Result<bool>;
fn exists(&self, _: &PathBuf) -> Result<bool>;
fn is_file(&self, _: &PathBuf) -> Result<bool>;
fn new_instance(&self, p: PathBuf) -> Box<FileAbstractionInstance>;
@ -97,8 +97,8 @@ mod test {
use super::FileAbstractionInstance;
use super::inmemory::InMemoryFileAbstraction;
use super::inmemory::InMemoryFileAbstractionInstance;
use storeid::StoreIdWithBase;
use store::Entry;
use crate::storeid::StoreIdWithBase;
use crate::store::Entry;
#[test]
fn lazy_file() {

View file

@ -27,10 +27,10 @@ macro_rules! mk_iterator_mod {
fun = $fun:expr
} => {
pub mod $modname {
use storeid::StoreId;
use crate::storeid::StoreId;
#[allow(unused_imports)]
use store::FileLockEntry;
use store::Store;
use crate::store::FileLockEntry;
use crate::store::Store;
use failure::Fallible as Result;
pub struct $itername<'a>(Box<Iterator<Item = Result<StoreId>> + 'a>, &'a Store);
@ -109,8 +109,8 @@ mod compile_test {
// This module contains code to check whether this actually compiles the way we would like it to
// compile
use store::Store;
use storeid::StoreId;
use crate::store::Store;
use crate::storeid::StoreId;
fn store() -> Store {
unimplemented!("Not implemented because in compile-test")
@ -137,13 +137,13 @@ mod compile_test {
}
}
use storeid::StoreId;
use storeid::StoreIdIterator;
use crate::storeid::StoreId;
use crate::storeid::StoreIdIterator;
use self::delete::StoreDeleteIterator;
use self::get::StoreGetIterator;
use self::retrieve::StoreRetrieveIterator;
use file_abstraction::iter::PathIterator;
use store::Store;
use crate::file_abstraction::iter::PathIterator;
use crate::store::Store;
use failure::Fallible as Result;
/// Iterator for iterating over all (or a subset of all) entries
@ -186,8 +186,8 @@ impl<'a> Entries<'a> {
/// Revisit whether this can be done in a cleaner way. See commit message for why this is
/// needed.
pub fn into_storeid_iter(self) -> StoreIdIterator {
use storeid::StoreIdWithBase;
use storeid::IntoStoreId;
use crate::storeid::StoreIdWithBase;
use crate::storeid::IntoStoreId;
let storepath = self.1.path().to_path_buf();
@ -243,9 +243,9 @@ mod tests {
let _ = env_logger::try_init();
}
use store::Store;
use storeid::StoreId;
use file_abstraction::inmemory::InMemoryFileAbstraction;
use crate::store::Store;
use crate::storeid::StoreId;
use crate::file_abstraction::inmemory::InMemoryFileAbstraction;
use libimagutil::variants::generate_variants;
pub fn get_store() -> Store {

View file

@ -41,12 +41,12 @@ use failure::ResultExt;
use failure::err_msg;
use failure::Error;
use storeid::{IntoStoreId, StoreId};
use iter::Entries;
use file_abstraction::FileAbstraction;
use file_abstraction::FileAbstractionInstance;
use file_abstraction::fs::FSFileAbstraction;
use file_abstraction::inmemory::InMemoryFileAbstraction;
use crate::storeid::{IntoStoreId, StoreId};
use crate::iter::Entries;
use crate::file_abstraction::FileAbstraction;
use crate::file_abstraction::FileAbstractionInstance;
use crate::file_abstraction::fs::FSFileAbstraction;
use crate::file_abstraction::inmemory::InMemoryFileAbstraction;
use libimagutil::debug_result::*;
@ -188,7 +188,7 @@ impl Store {
pub(crate) fn new_with_backend(location: PathBuf,
store_config: &Option<Value>,
backend: Arc<FileAbstraction>) -> Result<Store> {
use configuration::*;
use crate::configuration::*;
debug!("Building new Store object");
if !location.exists() {
@ -813,7 +813,7 @@ impl Entry {
/// - Header cannot be parsed into a TOML object
///
pub fn from_str<S: IntoStoreId>(loc: S, s: &str) -> Result<Entry> {
use util::entry_buffer_to_header_content;
use crate::util::entry_buffer_to_header_content;
let (header, content) = entry_buffer_to_header_content(s)?;
@ -865,7 +865,7 @@ impl Entry {
///
/// If an error is returned, the contents of neither the header nor the content are modified.
pub fn replace_from_buffer(&mut self, buf: &str) -> Result<()> {
let (header, content) = ::util::entry_buffer_to_header_content(buf)?;
let (header, content) = crate::util::entry_buffer_to_header_content(buf)?;
self.content = content;
self.header = header;
Ok(())
@ -931,9 +931,9 @@ mod test {
extern crate env_logger;
use std::collections::BTreeMap;
use storeid::StoreId;
use store::has_main_section;
use store::has_imag_version_in_main_section;
use crate::storeid::StoreId;
use crate::store::has_main_section;
use crate::store::has_imag_version_in_main_section;
use toml::Value;
@ -1058,7 +1058,7 @@ mod store_tests {
use super::Store;
pub fn get_store() -> Store {
use file_abstraction::inmemory::InMemoryFileAbstraction;
use crate::file_abstraction::inmemory::InMemoryFileAbstraction;
let backend = Arc::new(InMemoryFileAbstraction::default());
Store::new_with_backend(PathBuf::from("/"), &None, backend).unwrap()
}
@ -1141,7 +1141,7 @@ mod store_tests {
#[test]
fn test_store_create_in_hm() {
use storeid::StoreId;
use crate::storeid::StoreId;
let store = get_store();
@ -1156,7 +1156,7 @@ mod store_tests {
#[test]
fn test_store_retrieve_in_hm() {
use storeid::StoreId;
use crate::storeid::StoreId;
let store = get_store();
@ -1195,7 +1195,7 @@ mod store_tests {
#[test]
fn test_store_move_moves_in_hm() {
use storeid::StoreId;
use crate::storeid::StoreId;
setup_logging();
let store = get_store();

View file

@ -31,12 +31,12 @@ use failure::Fallible as Result;
use failure::err_msg;
use failure::Error;
use store::Store;
use crate::store::Store;
use iter::create::StoreCreateIterator;
use iter::delete::StoreDeleteIterator;
use iter::get::StoreGetIterator;
use iter::retrieve::StoreRetrieveIterator;
use crate::iter::create::StoreCreateIterator;
use crate::iter::delete::StoreDeleteIterator;
use crate::iter::get::StoreGetIterator;
use crate::iter::retrieve::StoreRetrieveIterator;
/// The Index into the Store
///
@ -344,14 +344,14 @@ mod test {
#[test]
fn test_correct_path() {
let p = ::storeid::test::module_path::new_id("test");
let p = crate::storeid::test::module_path::new_id("test");
assert_eq!(p.unwrap().to_str().unwrap(), "test/test");
}
#[test]
fn storeid_in_collection() {
let p = ::storeid::test::module_path::new_id("1/2/3/4/5/6/7/8/9/0").unwrap();
let p = crate::storeid::test::module_path::new_id("1/2/3/4/5/6/7/8/9/0").unwrap();
assert!(p.is_in_collection(&["test", "1"]));
assert!(p.is_in_collection(&["test", "1", "2"]));

View file

@ -38,7 +38,7 @@ use libimagentrylink::external::iter::UrlIter;
use libimagentrylink::internal::InternalLinker;
use libimagentrylink::internal::Link as StoreLink;
use link::Link;
use crate::link::Link;
use self::iter::LinksMatchingRegexIter;
@ -51,19 +51,19 @@ pub trait BookmarkCollectionStore<'a> {
impl<'a> BookmarkCollectionStore<'a> for Store {
fn new(&'a self, name: &str) -> Result<FileLockEntry<'a>> {
::module_path::new_id(name)
crate::module_path::new_id(name)
.and_then(|id| self.create(id).map_err(Error::from))
.map_err(Error::from)
}
fn get(&'a self, name: &str) -> Result<Option<FileLockEntry<'a>>> {
::module_path::new_id(name)
crate::module_path::new_id(name)
.and_then(|id| self.get(id).map_err(Error::from))
.map_err(Error::from)
}
fn delete(&'a self, name: &str) -> Result<()> {
::module_path::new_id(name)
crate::module_path::new_id(name)
.and_then(|id| self.delete(id).map_err(Error::from))
.map_err(Error::from)
}
@ -90,7 +90,7 @@ impl BookmarkCollection for Entry {
}
fn add_link(&mut self, store: &Store, l: Link) -> Result<Vec<StoreId>> {
use link::IntoUrl;
use crate::link::IntoUrl;
l.into_url().and_then(|url| self.add_external_link(store, url))
}
@ -100,14 +100,14 @@ impl BookmarkCollection for Entry {
}
fn remove_link(&mut self, store: &Store, l: Link) -> Result<Vec<StoreId>> {
use link::IntoUrl;
use crate::link::IntoUrl;
l.into_url().and_then(|url| self.remove_external_link(store, url))
}
}
pub mod iter {
use link::Link;
use crate::link::Link;
use failure::Fallible as Result;
use failure::Error;
@ -167,7 +167,7 @@ pub mod iter {
}
pub trait IntoLinksMatchingRegexIter<'a> {
fn matching_regex(self, Regex) -> LinksMatchingRegexIter<'a>;
fn matching_regex(self, _: Regex) -> LinksMatchingRegexIter<'a>;
}
impl<'a> IntoLinksMatchingRegexIter<'a> for UrlIter<'a> {

View file

@ -28,7 +28,7 @@ use libimagentryutil::isa::Is;
use libimagentryutil::isa::IsKindHeaderPathProvider;
use libimagerror::errors::ErrorMsg as EM;
use deser::DeserVcard;
use crate::deser::DeserVcard;
/// Trait to be implemented on ::libimagstore::store::Entry
pub trait Contact {

View file

@ -22,7 +22,7 @@ use libimagstore::store::Store;
use libimagstore::store::FileLockEntry;
use libimagerror::errors::ErrorMsg as EM;
use contact::Contact;
use crate::contact::Contact;
use failure::Fallible as Result;
use failure::Error;

View file

@ -35,9 +35,9 @@ use libimagstore::store::FileLockEntry;
use libimagentryutil::isa::Is;
use libimagentryref::reference::{MutRef, Config as RefConfig};
use contact::IsContact;
use deser::DeserVcard;
use util;
use crate::contact::IsContact;
use crate::deser::DeserVcard;
use crate::util;
pub trait ContactStore<'a> {
@ -164,7 +164,7 @@ fn prepare_fetching_from_store(buf: &str) -> Result<(StoreId, Value)> {
toml_from_str::<Value>(&serialized)?
};
let sid = ::module_path::new_id(uid.raw())?;
let sid = crate::module_path::new_id(uid.raw())?;
Ok((sid, value))
}

View file

@ -32,11 +32,11 @@ use chrono::Timelike;
use failure::Fallible as Result;
use failure::Error;
use entry::IsDiaryEntry;
use diaryid::DiaryId;
use diaryid::FromStoreId;
use iter::DiaryEntryIterator;
use iter::DiaryNameIterator;
use crate::entry::IsDiaryEntry;
use crate::diaryid::DiaryId;
use crate::diaryid::FromStoreId;
use crate::iter::DiaryEntryIterator;
use crate::iter::DiaryNameIterator;
pub trait Diary {

View file

@ -150,7 +150,7 @@ impl IntoStoreId for DiaryId {
fn into_storeid(self) -> Result<StoreId> {
use std::path::PathBuf;
let s : String = self.into();
::module_path::new_id(PathBuf::from(s))
crate::module_path::new_id(PathBuf::from(s))
}
}
@ -184,7 +184,7 @@ impl Into<NaiveDateTime> for DiaryId {
}
pub trait FromStoreId : Sized {
fn from_storeid(&StoreId) -> Result<Self>;
fn from_storeid(_: &StoreId) -> Result<Self>;
}
use std::path::Component;

View file

@ -23,8 +23,8 @@ use libimagentryutil::isa::IsKindHeaderPathProvider;
use failure::Fallible as Result;
use diaryid::DiaryId;
use diaryid::FromStoreId;
use crate::diaryid::DiaryId;
use crate::diaryid::FromStoreId;
provide_kindflag_path!(pub IsDiaryEntry, "diary.is_diary_entry");

View file

@ -25,7 +25,7 @@ use filters::filter::Filter;
use libimagstore::storeid::StoreIdIterator;
use libimagstore::storeid::StoreId;
use is_in_diary::IsInDiary;
use crate::is_in_diary::IsInDiary;
use failure::Fallible as Result;
use failure::Error;
use failure::err_msg;

View file

@ -30,7 +30,7 @@ use failure::Error;
use libimagstore::store::Entry;
use libimagentryview::viewer::Viewer;
use libimagentryview::builtin::plain::PlainViewer;
use entry::DiaryEntry;
use crate::entry::DiaryEntry;
/// This viewer does _not_ implement libimagentryview::viewer::Viewer because we need to be able to
/// call some diary-type specific functions on the entries passed to this.

View file

@ -27,10 +27,10 @@ use failure::Error;
use failure::Fallible as Result;
use failure::err_msg;
use iter::HabitInstanceStoreIdIterator;
use util::IsHabitCheck;
use util::get_string_header_from_entry;
use instance::IsHabitInstance;
use crate::iter::HabitInstanceStoreIdIterator;
use crate::util::IsHabitCheck;
use crate::util::get_string_header_from_entry;
use crate::instance::IsHabitInstance;
use libimagentrylink::internal::InternalLinker;
use libimagstore::store::Store;
@ -161,7 +161,7 @@ impl HabitTemplate for Entry {
debug!("Increment is {:?}", increment);
let until = self.habit_until_date()?.map(|s| -> Result<_> {
try!(date_from_s(s))
r#try!(date_from_s(s))
.calculate()?
.get_moment()
.map(Clone::clone)
@ -257,7 +257,7 @@ impl HabitTemplate for Entry {
}
fn instance_id_for_name_and_datestr(habit_name: &String, habit_date: &String) -> Result<StoreId> {
::module_path::new_id(format!("instance/{}-{}", habit_name, habit_date)).map_err(Error::from)
crate::module_path::new_id(format!("instance/{}-{}", habit_name, habit_date)).map_err(Error::from)
}
pub mod builder {
@ -276,7 +276,7 @@ pub mod builder {
use failure::err_msg;
use libimagutil::date::date_to_string;
use habit::IsHabitTemplate;
use crate::habit::IsHabitTemplate;
#[derive(Debug)]
pub struct HabitBuilder {
@ -348,10 +348,10 @@ pub mod builder {
debug!("Success: Date valid");
let comment = self.comment.unwrap_or_else(|| String::new());
let sid = try!(build_habit_template_sid(&name));
let sid = r#try!(build_habit_template_sid(&name));
debug!("Creating entry in store for: {:?}", sid);
let mut entry = try!(store.create(sid));
let mut entry = r#try!(store.create(sid));
let _ = entry.set_isflag::<IsHabitTemplate>()?;
{
@ -364,7 +364,7 @@ pub mod builder {
if let Some(until) = self.untildate {
let until = date_to_string(&until);
try!(entry.get_header_mut().insert("habit.template.until", Value::String(until)));
r#try!(entry.get_header_mut().insert("habit.template.until", Value::String(until)));
}
debug!("Success: Created entry in store and set headers");
@ -387,7 +387,7 @@ pub mod builder {
/// Buld a StoreId for a Habit from a date object and a name of a habit
fn build_habit_template_sid(name: &String) -> Result<StoreId> {
::module_path::new_id(format!("template/{}", name)).map_err(From::from)
crate::module_path::new_id(format!("template/{}", name)).map_err(From::from)
}
}

View file

@ -22,7 +22,7 @@ use toml::Value;
use toml_query::set::TomlValueSetExt;
use failure::Fallible as Result;
use util::*;
use crate::util::*;
use libimagstore::store::Entry;
use libimagentryutil::isa::Is;

View file

@ -24,7 +24,7 @@ use libimagstore::storeid::StoreIdIterator;
use libimagstore::storeid::StoreIdIteratorWithStore;
use libimagstore::storeid::StoreId;
use util::IsHabitCheck;
use crate::util::IsHabitCheck;
pub struct HabitTemplateStoreIdIterator(StoreIdIterator);

View file

@ -19,9 +19,9 @@
use failure::Fallible as Result;
use habit::builder::HabitBuilder;
use iter::HabitTemplateStoreIdIterator;
use iter::HabitInstanceStoreIdIterator;
use crate::habit::builder::HabitBuilder;
use crate::iter::HabitTemplateStoreIdIterator;
use crate::iter::HabitInstanceStoreIdIterator;
use libimagstore::store::Store;

View file

@ -22,8 +22,8 @@ use std::ops::BitXor;
use failure::Error;
use failure::Fallible as Result;
use habit::HabitTemplate;
use instance::HabitInstance;
use crate::habit::HabitTemplate;
use crate::instance::HabitInstance;
use libimagstore::storeid::StoreId;
use libimagstore::store::Entry;

View file

@ -46,7 +46,7 @@ impl Hasher for MailHasher {
.map(String::from)
.ok_or_else(|| ErrorMsg::UTF8Error)?;
let message_id = ::util::get_message_id_for_mailfile(path)?;
let message_id = crate::util::get_message_id_for_mailfile(path)?;
path_str.push_str(&message_id);

View file

@ -48,7 +48,7 @@ impl Mail for Entry {
/// Get a value of a single field of the mail file
fn get_field(&self, refconfig: &RefConfig, field: &str) -> Result<Option<String>> {
use std::fs::read_to_string;
use hasher::MailHasher;
use crate::hasher::MailHasher;
debug!("Getting field in mail: {:?}", field);
let mail_file_location = self.as_ref_with_hasher::<MailHasher>().get_path(refconfig)?;
@ -107,7 +107,7 @@ impl Mail for Entry {
/// Use `Mail::mail_header()` if you need to read more than one field.
fn get_message_id(&self, refconfig: &RefConfig) -> Result<Option<String>> {
self.get_field(refconfig, "Message-ID")
.map(|o| o.map(::util::strip_message_delimiters))
.map(|o| o.map(crate::util::strip_message_delimiters))
}
/// Get a value of the `In-Reply-To` field of the mail file

View file

@ -35,10 +35,10 @@ use libimagentryref::reference::RefFassade;
use libimagentryref::reference::Ref;
use libimagentryref::reference::MutRef;
use mid::MessageId;
use mail::Mail;
use hasher::MailHasher;
use util::get_message_id_for_mailfile;
use crate::mid::MessageId;
use crate::mail::Mail;
use crate::hasher::MailHasher;
use crate::util::get_message_id_for_mailfile;
pub trait MailStore<'a> {
fn create_mail_from_path<P, CollName>(&'a self, p: P, collection_name: CollName, config: &Config)
@ -67,7 +67,7 @@ impl<'a> MailStore<'a> for Store {
CollName: AsRef<str> + Debug
{
let message_id = get_message_id_for_mailfile(p.as_ref())?;
let new_sid = ::module_path::new_id(message_id.clone())?;
let new_sid = crate::module_path::new_id(message_id.clone())?;
let mut entry = self.create(new_sid)?;
let _ = entry
@ -88,7 +88,7 @@ impl<'a> MailStore<'a> for Store {
where P: AsRef<Path> + Debug
{
let message_id = get_message_id_for_mailfile(p.as_ref())?;
let new_sid = ::module_path::new_id(message_id.clone())?;
let new_sid = crate::module_path::new_id(message_id.clone())?;
match self.get(new_sid)? {
Some(mut entry) => {
@ -115,7 +115,7 @@ impl<'a> MailStore<'a> for Store {
CollName: AsRef<str> + Debug
{
let message_id = get_message_id_for_mailfile(&p)?;
let new_sid = ::module_path::new_id(message_id.clone())?;
let new_sid = crate::module_path::new_id(message_id.clone())?;
let mut entry = self.retrieve(new_sid)?;
let _ = entry

View file

@ -20,7 +20,7 @@
use libimagstore::storeid::StoreId;
use libimagstore::storeid::StoreIdIterator;
use notestoreid::*;
use crate::notestoreid::*;
use failure::Fallible as Result;
use failure::Error;

View file

@ -25,7 +25,7 @@ use libimagstore::store::Store;
use toml_query::insert::TomlValueInsertExt;
use failure::Fallible as Result;
use iter::*;
use crate::iter::*;
pub trait NoteStore<'a> {
fn new_note(&'a self, name: String, text: String) -> Result<FileLockEntry<'a>>;
@ -43,7 +43,7 @@ impl<'a> NoteStore<'a> for Store {
debug!("Creating new Note: '{}'", name);
let fle = {
let mut lockentry = ::module_path::new_id(name.clone()).and_then(|id| self.create(id))?;
let mut lockentry = crate::module_path::new_id(name.clone()).and_then(|id| self.create(id))?;
{
let entry = lockentry.deref_mut();
@ -58,15 +58,15 @@ impl<'a> NoteStore<'a> for Store {
}
fn delete_note(&'a self, name: String) -> Result<()> {
::module_path::new_id(name).and_then(|id| self.delete(id))
crate::module_path::new_id(name).and_then(|id| self.delete(id))
}
fn retrieve_note(&'a self, name: String) -> Result<FileLockEntry<'a>> {
::module_path::new_id(name).and_then(|id| self.retrieve(id))
crate::module_path::new_id(name).and_then(|id| self.retrieve(id))
}
fn get_note(&'a self, name: String) -> Result<Option<FileLockEntry<'a>>> {
::module_path::new_id(name).and_then(|id| self.get(id))
crate::module_path::new_id(name).and_then(|id| self.get(id))
}
fn all_notes(&'a self) -> Result<NoteIterator> {

View file

@ -23,9 +23,9 @@ use chrono::naive::NaiveDateTime as NDT;
use failure::Fallible as Result;
use failure::Error;
use constants::*;
use iter::storeid::TagStoreIdIter;
use iter::setendtime::SetEndTimeIter;
use crate::constants::*;
use crate::iter::storeid::TagStoreIdIter;
use crate::iter::setendtime::SetEndTimeIter;
use libimagstore::store::FileLockEntry;
use libimagstore::store::Store;

View file

@ -21,8 +21,8 @@ use chrono::NaiveDateTime;
use libimagstore::store::FileLockEntry;
use tag::TimeTrackingTag as TTT;
use timetracking::TimeTracking;
use crate::tag::TimeTrackingTag as TTT;
use crate::timetracking::TimeTracking;
pub fn has_start_time(entry: &FileLockEntry) -> bool {
@ -57,8 +57,8 @@ mod types {
use chrono::NaiveDateTime;
use filters::filter::Filter;
use tag::TimeTrackingTag as TTT;
use timetracking::TimeTracking;
use crate::tag::TimeTrackingTag as TTT;
use crate::timetracking::TimeTracking;
use libimagstore::store::FileLockEntry;

View file

@ -23,7 +23,7 @@ use libimagstore::store::FileLockEntry;
use failure::Fallible as Result;
use constants::*;
use crate::constants::*;
pub struct TimeTrackingsGetIterator<'a>(Entries<'a>, &'a Store);

View file

@ -22,8 +22,8 @@ use toml_query::insert::TomlValueInsertExt;
use chrono::naive::NaiveDateTime as NDT;
use failure::Fallible as Result;
use constants::*;
use iter::create::CreateTimeTrackIter;
use crate::constants::*;
use crate::iter::create::CreateTimeTrackIter;
use libimagstore::store::FileLockEntry;

View file

@ -21,9 +21,9 @@ use chrono::naive::NaiveDateTime as NDT;
use failure::Fallible as Result;
use failure::Error;
use constants::*;
use iter::tag::TagIter;
use iter::create::CreateTimeTrackIter;
use crate::constants::*;
use crate::iter::tag::TagIter;
use crate::iter::create::CreateTimeTrackIter;
use libimagstore::store::Store;
use libimagstore::storeid::StoreId;
@ -54,7 +54,7 @@ impl Iterator for TagStoreIdIter {
.map(|res| res.and_then(|tag| {
let dt = self.datetime.format(DATE_TIME_FORMAT).to_string();
let id_str = format!("{}-{}", dt, tag.as_str());
::module_path::new_id(id_str)
crate::module_path::new_id(id_str)
.map_err(Error::from)
.map(|id| (id, self.datetime.clone()))
}))

View file

@ -22,8 +22,8 @@ use failure::Fallible as Result;
use failure::Error;
use failure::err_msg;
use tag::TimeTrackingTag as TTT;
use iter::storeid::TagStoreIdIter;
use crate::tag::TimeTrackingTag as TTT;
use crate::iter::storeid::TagStoreIdIter;
use libimagentrytag::tag::is_tag_str;

View file

@ -29,8 +29,8 @@ use chrono::naive::NaiveDateTime;
use libimagstore::store::Entry;
use libimagerror::errors::ErrorMsg as EM;
use tag::TimeTrackingTag as TTT;
use constants::*;
use crate::tag::TimeTrackingTag as TTT;
use crate::constants::*;
use toml::Value;
use toml_query::delete::TomlValueDeleteExt;

View file

@ -32,10 +32,10 @@ use libimagstore::store::Store;
use libimagstore::store::FileLockEntry;
use libimagentrydatetime::datepath::compiler::DatePathCompiler;
use constants::*;
use iter::get::TimeTrackingsGetIterator;
use crate::constants::*;
use crate::iter::get::TimeTrackingsGetIterator;
use tag::TimeTrackingTag as TTT;
use crate::tag::TimeTrackingTag as TTT;
pub trait TimeTrackStore<'a> {

View file

@ -34,7 +34,7 @@ use failure::err_msg;
use libimagstore::store::{FileLockEntry, Store};
use libimagerror::errors::ErrorMsg as EM;
use iter::TaskIdIterator;
use crate::iter::TaskIdIterator;
/// Task struct containing a `FileLockEntry`
pub trait TaskStore<'a> {
@ -99,7 +99,7 @@ impl<'a> TaskStore<'a> for Store {
///
/// If there is no task with this UUID, this returns `Ok(None)`.
fn get_task_from_uuid(&'a self, uuid: Uuid) -> Result<Option<FileLockEntry<'a>>> {
::module_path::new_id(format!("taskwarrior/{}", uuid)).and_then(|store_id| self.get(store_id))
crate::module_path::new_id(format!("taskwarrior/{}", uuid)).and_then(|store_id| self.get(store_id))
}
/// Same as Task::get_from_import() but uses Store::retrieve() rather than Store::get(), to
@ -150,7 +150,7 @@ impl<'a> TaskStore<'a> for Store {
}
fn delete_task_by_uuid(&self, uuid: Uuid) -> Result<()> {
::module_path::new_id(format!("taskwarrior/{}", uuid)).and_then(|id| self.delete(id))
crate::module_path::new_id(format!("taskwarrior/{}", uuid)).and_then(|id| self.delete(id))
}
fn all_tasks(&self) -> Result<TaskIdIterator> {
@ -162,7 +162,7 @@ impl<'a> TaskStore<'a> for Store {
use toml_query::set::TomlValueSetExt;
let uuid = task.uuid();
::module_path::new_id(format!("taskwarrior/{}", uuid)).and_then(|id| {
crate::module_path::new_id(format!("taskwarrior/{}", uuid)).and_then(|id| {
self.retrieve(id).and_then(|mut fle| {
{
let hdr = fle.get_header_mut();

View file

@ -23,7 +23,7 @@ use libimagstore::storeid::StoreId;
use failure::Fallible as Result;
use wiki::Wiki;
use crate::wiki::Wiki;
pub trait WikiStore {
@ -82,6 +82,6 @@ impl WikiStore for Store {
}
fn wiki_path(name: &str) -> Result<StoreId> {
::module_path::new_id(name)
crate::module_path::new_id(name)
}

View file

@ -47,14 +47,14 @@ impl<'a, 'b> Wiki<'a, 'b> {
pub(crate) fn create_index_page(&self) -> Result<FileLockEntry<'a>> {
let path = PathBuf::from(format!("{}/index", self.1));
let sid = ::module_path::new_id(path)?;
let sid = crate::module_path::new_id(path)?;
self.0.create(sid)
}
pub(crate) fn get_index_page(&self) -> Result<FileLockEntry<'a>> {
let path = PathBuf::from(format!("{}/index", self.1));
let sid = ::module_path::new_id(path)?;
let sid = crate::module_path::new_id(path)?;
self.0
.get(sid)
@ -64,13 +64,13 @@ impl<'a, 'b> Wiki<'a, 'b> {
pub fn get_entry<EN: AsRef<str>>(&self, entry_name: EN) -> Result<Option<FileLockEntry<'a>>> {
let path = PathBuf::from(format!("{}/{}", self.1, entry_name.as_ref()));
let sid = ::module_path::new_id(path)?;
let sid = crate::module_path::new_id(path)?;
self.0.get(sid)
}
pub fn create_entry<EN: AsRef<str>>(&self, entry_name: EN) -> Result<FileLockEntry<'a>> {
let path = PathBuf::from(format!("{}/{}", self.1, entry_name.as_ref()));
let sid = ::module_path::new_id(path)?;
let sid = crate::module_path::new_id(path)?;
let mut index = self
.get_entry("index")?
.ok_or_else(|| err_msg("Missing index page"))?;
@ -81,7 +81,7 @@ impl<'a, 'b> Wiki<'a, 'b> {
pub fn retrieve_entry<EN: AsRef<str>>(&self, entry_name: EN) -> Result<FileLockEntry<'a>> {
let path = PathBuf::from(format!("{}/{}", self.1, entry_name.as_ref()));
let sid = ::module_path::new_id(path)?;
let sid = crate::module_path::new_id(path)?;
let mut index = self
.get_entry("index")?
.ok_or_else(|| err_msg("Missing index page"))?;
@ -96,7 +96,7 @@ impl<'a, 'b> Wiki<'a, 'b> {
pub fn delete_entry<EN: AsRef<str>>(&self, entry_name: EN) -> Result<()> {
let path = PathBuf::from(format!("{}/{}", self.1, entry_name.as_ref()));
let sid = ::module_path::new_id(path)?;
let sid = crate::module_path::new_id(path)?;
self.0.delete(sid)
}
}

View file

@ -51,7 +51,7 @@ impl Annotateable for Entry {
let ann_name = Uuid::new_v4().to_hyphenated().to_string();
debug!("Creating annotation with name = {}", ann_name);
store.retrieve(::module_path::new_id(ann_name.clone())?)
store.retrieve(crate::module_path::new_id(ann_name.clone())?)
.and_then(|mut anno| {
{
let _ = anno.set_isflag::<IsAnnotation>()?;
@ -73,7 +73,7 @@ impl Annotateable for Entry {
// Fails if there's no such annotation entry or if the link to that annotation entry does not
// exist.
fn denotate<'a>(&mut self, store: &'a Store, ann_name: &str) -> Result<Option<FileLockEntry<'a>>> {
if let Some(mut annotation) = store.get(::module_path::new_id(ann_name)?)? {
if let Some(mut annotation) = store.get(crate::module_path::new_id(ann_name)?)? {
let _ = self.remove_internal_link(&mut annotation)?;
Ok(Some(annotation))
} else {

View file

@ -29,8 +29,8 @@ use toml_query::read::TomlValueReadTypeExt;
use failure::Fallible as Result;
use failure::Error;
use failure::err_msg;
use store::CATEGORY_REGISTER_NAME_FIELD_PATH;
use iter::CategoryEntryIterator;
use crate::store::CATEGORY_REGISTER_NAME_FIELD_PATH;
use crate::iter::CategoryEntryIterator;
provide_kindflag_path!(pub IsCategory, "category.is_category");

View file

@ -30,7 +30,7 @@ use failure::Fallible as Result;
use failure::ResultExt;
use failure::Error;
use failure::err_msg;
use store::CategoryStore;
use crate::store::CategoryStore;
pub trait EntryCategory {

View file

@ -28,8 +28,8 @@ use failure::Fallible as Result;
use failure::ResultExt;
use failure::Error;
use failure::err_msg;
use store::CATEGORY_REGISTER_NAME_FIELD_PATH;
use entry::EntryCategory;
use crate::store::CATEGORY_REGISTER_NAME_FIELD_PATH;
use crate::entry::EntryCategory;
/// Iterator for Category names
///

View file

@ -31,8 +31,8 @@ use failure::Fallible as Result;
use failure::ResultExt;
use failure::Error;
use failure::err_msg;
use iter::CategoryNameIter;
use category::IsCategory;
use crate::iter::CategoryNameIter;
use crate::category::IsCategory;
pub const CATEGORY_REGISTER_NAME_FIELD_PATH : &'static str = "category.register.name";
@ -85,7 +85,7 @@ impl CategoryStore for Store {
/// Automatically removes all category settings from entries which are linked to this category.
fn delete_category(&self, name: &str) -> Result<()> {
use libimagentrylink::internal::InternalLinker;
use category::Category;
use crate::category::Category;
trace!("Deleting category: '{}'", name);
let sid = mk_category_storeid(name)?;
@ -208,7 +208,7 @@ mod tests {
#[inline]
fn mk_category_storeid(s: &str) -> Result<StoreId> {
::module_path::new_id(s).context(err_msg("Store id handling error")).map_err(Error::from)
crate::module_path::new_id(s).context(err_msg("Store id handling error")).map_err(Error::from)
}
#[inline]

View file

@ -25,8 +25,8 @@ use chrono::Timelike;
use libimagstore::storeid::StoreId;
use datepath::accuracy::Accuracy;
use datepath::format::Format;
use crate::datepath::accuracy::Accuracy;
use crate::datepath::format::Format;
use failure::Fallible as Result;
pub struct DatePathCompiler {
@ -127,8 +127,8 @@ impl DatePathCompiler {
#[cfg(test)]
mod test {
use super::*;
use datepath::accuracy::Accuracy;
use datepath::format::Format;
use crate::datepath::accuracy::Accuracy;
use crate::datepath::format::Format;
use chrono::naive::NaiveDate;
use chrono::naive::NaiveDateTime;

View file

@ -21,7 +21,7 @@ use chrono::naive::NaiveDateTime;
use failure::Fallible as Result;
use libimagstore::storeid::StoreId;
use datepath::compiler::DatePathCompiler;
use crate::datepath::compiler::DatePathCompiler;
//
// Extension Trait for NaiveDateTime

View file

@ -30,7 +30,7 @@ use failure::Error;
use failure::Fallible as Result;
use failure::ResultExt;
use failure::err_msg;
use range::DateTimeRange;
use crate::range::DateTimeRange;
pub trait EntryDate {

View file

@ -19,9 +19,9 @@
use libimagstore::store::Entry;
use builtin::header::field_path::FieldPath;
use builtin::header::field_predicate::FieldPredicate;
use builtin::header::field_predicate::Predicate;
use crate::builtin::header::field_path::FieldPath;
use crate::builtin::header::field_predicate::FieldPredicate;
use crate::builtin::header::field_predicate::Predicate;
use filters::failable::filter::FailableFilter;
use failure::Fallible as Result;

View file

@ -25,7 +25,7 @@ use filters::failable::filter::FailableFilter;
use failure::Fallible as Result;
use failure::Error;
use builtin::header::field_path::FieldPath;
use crate::builtin::header::field_path::FieldPath;
pub struct FieldExists {
header_field_path: FieldPath,

View file

@ -22,9 +22,9 @@ use toml::Value;
use libimagstore::store::Entry;
use builtin::header::field_path::FieldPath;
use builtin::header::field_predicate::FieldPredicate;
use builtin::header::field_predicate::Predicate;
use crate::builtin::header::field_path::FieldPath;
use crate::builtin::header::field_predicate::FieldPredicate;
use crate::builtin::header::field_predicate::Predicate;
use filters::failable::filter::FailableFilter;
use failure::Fallible as Result;

View file

@ -19,9 +19,9 @@
use libimagstore::store::Entry;
use builtin::header::field_path::FieldPath;
use builtin::header::field_predicate::FieldPredicate;
use builtin::header::field_predicate::Predicate;
use crate::builtin::header::field_path::FieldPath;
use crate::builtin::header::field_predicate::FieldPredicate;
use crate::builtin::header::field_predicate::Predicate;
use filters::failable::filter::FailableFilter;
use failure::Fallible as Result;

View file

@ -20,7 +20,7 @@
use libimagstore::store::Entry;
use toml_query::read::TomlValueReadExt;
use builtin::header::field_path::FieldPath;
use crate::builtin::header::field_path::FieldPath;
use filters::failable::filter::FailableFilter;
use failure::Fallible as Result;

View file

@ -19,9 +19,9 @@
use libimagstore::store::Entry;
use builtin::header::field_path::FieldPath;
use builtin::header::field_predicate::FieldPredicate;
use builtin::header::field_predicate::Predicate;
use crate::builtin::header::field_path::FieldPath;
use crate::builtin::header::field_predicate::FieldPredicate;
use crate::builtin::header::field_predicate::Predicate;
use filters::failable::filter::FailableFilter;
use failure::Fallible as Result;

View file

@ -19,9 +19,9 @@
use libimagstore::store::Entry;
use builtin::header::field_path::FieldPath;
use builtin::header::field_predicate::FieldPredicate;
use builtin::header::field_predicate::Predicate;
use crate::builtin::header::field_path::FieldPath;
use crate::builtin::header::field_predicate::FieldPredicate;
use crate::builtin::header::field_predicate::Predicate;
use filters::failable::filter::FailableFilter;
use failure::Fallible as Result;

View file

@ -22,14 +22,14 @@ use libimagstore::store::Entry;
use toml_query::read::TomlValueReadExt;
use toml::Value;
use builtin::header::field_path::FieldPath;
use crate::builtin::header::field_path::FieldPath;
use filters::failable::filter::FailableFilter;
use failure::Fallible as Result;
use failure::Error;
pub trait Predicate {
fn evaluate(&self, &Value) -> bool;
fn evaluate(&self, _: &Value) -> bool;
}
/// Check whether certain header field in a entry is equal to a value

View file

@ -21,8 +21,8 @@ use semver::Version;
use libimagstore::store::Entry;
use builtin::header::version::gt::VersionGt;
use builtin::header::version::lt::VersionLt;
use crate::builtin::header::version::gt::VersionGt;
use crate::builtin::header::version::lt::VersionLt;
use filters::filter::Filter;
use filters::ops::and::And;
use filters::ops::not::Not;

View file

@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
use types::*;
use crate::types::*;
use libimagstore::store::Entry;
@ -107,7 +107,7 @@ mod tests {
use libimagstore::store::Store;
use entry::*;
use crate::entry::*;
fn setup_logging() {
let _ = ::env_logger::try_init;

View file

@ -48,7 +48,7 @@ use failure::Fallible as Result;
use failure::ResultExt;
use failure::err_msg;
use internal::InternalLinker;
use crate::internal::InternalLinker;
use self::iter::*;
@ -132,8 +132,8 @@ pub mod iter {
use libimagutil::debug_result::*;
use libimagstore::store::Store;
use internal::Link;
use internal::iter::LinkIter;
use crate::internal::Link;
use crate::internal::iter::LinkIter;
use failure::Fallible as Result;
use url::Url;
@ -262,7 +262,7 @@ pub mod iter {
type Item = Result<Url>;
fn next(&mut self) -> Option<Self::Item> {
use external::Link;
use crate::external::Link;
loop {
let next = self.0
@ -335,7 +335,7 @@ impl ExternalLinker for Entry {
debug!("Iterating {} links = {:?}", links.len(), links);
links.into_iter().map(|link| {
let hash = hex::encode(Sha1::digest(&link.as_str().as_bytes()));
let file_id = ::module_path::new_id(format!("external/{}", hash))
let file_id = crate::module_path::new_id(format!("external/{}", hash))
.map_dbg_err(|_| {
format!("Failed to build StoreId for this hash '{:?}'", hash)
})?;

View file

@ -504,7 +504,7 @@ pub mod store_check {
fn check_link_consistency(&self) -> Result<()> {
use std::collections::HashMap;
use internal::InternalLinker;
use crate::internal::InternalLinker;
use libimagstore::storeid::StoreId;
use libimagutil::debug_result::DebugResult;

View file

@ -22,7 +22,7 @@ use std::collections::BTreeMap;
use failure::Fallible as Result;
use failure::ResultExt;
use failure::Error;
use link::extract_links;
use crate::link::extract_links;
use libimagentrylink::external::ExternalLinker;
use libimagentrylink::internal::InternalLinker;

View file

@ -38,7 +38,7 @@ pub mod sha1 {
use failure::Fallible as Result;
use sha1::{Sha1, Digest};
use hasher::Hasher;
use crate::hasher::Hasher;
pub struct Sha1Hasher;

View file

@ -37,7 +37,7 @@ use failure::Error;
use failure::err_msg;
use failure::ResultExt;
use hasher::Hasher;
use crate::hasher::Hasher;
/// A configuration of "basepath name" -> "basepath path" mappings
///
@ -91,8 +91,8 @@ pub mod fassade {
use failure::Fallible as Result;
use failure::Error;
use hasher::sha1::Sha1Hasher;
use hasher::Hasher;
use crate::hasher::sha1::Sha1Hasher;
use crate::hasher::Hasher;
use super::IsRef;
pub trait RefFassade {
@ -436,7 +436,7 @@ mod test {
use libimagstore::store::Entry;
use super::*;
use hasher::Hasher;
use crate::hasher::Hasher;
fn setup_logging() {
let _ = ::env_logger::try_init();

View file

@ -21,7 +21,7 @@ use failure::Fallible as Result;
use libimagrt::runtime::Runtime;
use reference::Config as RefConfig;
use crate::reference::Config as RefConfig;
pub fn get_ref_config(rt: &Runtime, app_name: &'static str) -> Result<RefConfig> {
use toml_query::read::TomlValueReadExt;

View file

@ -29,8 +29,8 @@ use failure::Error;
use failure::ResultExt;
use failure::Fallible as Result;
use failure::err_msg;
use tag::{Tag, TagSlice};
use tag::is_tag_str;
use crate::tag::{Tag, TagSlice};
use crate::tag::is_tag_str;
use toml::Value;

View file

@ -23,7 +23,7 @@ use libimagstore::store::Entry;
use libimagrt::runtime::Runtime;
use libimagentryedit::edit::edit_in_tmpfile;
use viewer::Viewer;
use crate::viewer::Viewer;
use failure::Fallible as Result;
use failure::ResultExt;
use failure::Error;

View file

@ -26,7 +26,7 @@ use mdcat::{AnsiTerminal, ResourceAccess, TerminalSize};
use pulldown_cmark::Parser;
use syntect::parsing::SyntaxSet;
use viewer::Viewer;
use crate::viewer::Viewer;
use failure::Fallible as Result;
use failure::Error;

Some files were not shown because too many files have changed in this diff Show more