Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions arx/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ fn configure_log(verbose: u8) {
_ => log::LevelFilter::Trace,
},
)
.filter_module(
"libarx",
match verbose {
0 => log::LevelFilter::Warn,
1 => log::LevelFilter::Info,
2 => log::LevelFilter::Debug,
_ => log::LevelFilter::Trace,
},
)
.format_module_path(false)
.format_timestamp(None)
.init();
Expand Down
2 changes: 1 addition & 1 deletion arx/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ macro_rules! join {
};
(@init, $first:expr, $($args:tt),+) => {
{
let mut path:PathBuf = AsRef::<Path>::as_ref(&$first).to_path_buf();
let mut path:std::path::PathBuf = std::convert::AsRef::<std::path::Path>::as_ref(&$first).to_path_buf();
join!(@append, path, $($args),+);
path
}
Expand Down
28 changes: 16 additions & 12 deletions libarx/src/create/entry_store_creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ impl DirEntry {
let mut write_children = self.children.try_write().unwrap();
match write_children.get_mut(component.as_str()).unwrap() {
DirOrFile::Dir(e) => e.add(entry, components, entry_store),
DirOrFile::File(_) => Err(IncoherentStructure(
"Cannot add a entry to something which is not a directory".into(),
)
DirOrFile::File(_) => Err(IncoherentStructure(format!(
"Adding {}, cannot add a entry to something which is not a directory",
entry.path()
))
.into()),
}
}
Expand Down Expand Up @@ -172,9 +173,10 @@ impl DirEntry {
match self.children.try_read().unwrap().get(entry_name) {
Some(DirOrFile::Dir(_)) => return Ok(()),
Some(DirOrFile::File(_)) => {
return Err(IncoherentStructure(
"Cannot add a dir when file or link already exists".into(),
)
return Err(IncoherentStructure(format!(
"Adding {}, cannot add a dir when file or link already exists",
entry.path()
))
.into())
}
None => {}
Expand Down Expand Up @@ -208,9 +210,10 @@ impl DirEntry {
}
EntryKind::File(size, content_address) => {
if self.children.try_read().unwrap().contains_key(entry_name) {
return Err(IncoherentStructure(
"Cannot add a file when one already exists".into(),
)
return Err(IncoherentStructure(format!(
"Adding {}, cannot add a file when one already exists",
entry.path()
))
.into());
}
values.insert(Property::Content, jbk::Value::Content(content_address));
Expand All @@ -229,9 +232,10 @@ impl DirEntry {
}
EntryKind::Link(target) => {
if self.children.try_read().unwrap().contains_key(entry_name) {
return Err(IncoherentStructure(
"Cannot add a link when one already exists".into(),
)
return Err(IncoherentStructure(format!(
"Adding {}, cannot add a link when one already exists",
entry.path()
))
.into());
}
values.insert(
Expand Down
2 changes: 1 addition & 1 deletion python/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Entry {
/// Get the link target of the link entry.
///
/// Raise an exception if entry is not a link.
fn get_target(&self) -> PyResult<Cow<[u8]>> {
fn get_target(&self) -> PyResult<Cow<'_, [u8]>> {
match &self.entry {
arx::Entry::Link(l) => Ok(l.target().into()),
_ => Err(PyTypeError::new_err("Not a link")),
Expand Down
Loading