[niepce] rust: minor style fixes
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] rust: minor style fixes
- Date: Sat, 21 Oct 2017 04:39:47 +0000 (UTC)
commit a494f7e8db57d452fef04946fc202e2b0e759a60
Author: Hubert Figuière <hub figuiere net>
Date: Mon Oct 9 10:46:24 2017 -0400
rust: minor style fixes
src/engine/db/filebundle.rs | 6 +++---
src/fwk/utils/exempi.rs | 15 ++++++---------
2 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/src/engine/db/filebundle.rs b/src/engine/db/filebundle.rs
index 50d2b6b..3eedf33 100644
--- a/src/engine/db/filebundle.rs
+++ b/src/engine/db/filebundle.rs
@@ -35,9 +35,9 @@ impl FileBundle {
pub fn new() -> FileBundle {
FileBundle {
file_type: FileType::UNKNOWN,
- main: String::from(""),
- xmp_sidecar: String::from(""),
- jpeg: String::from(""),
+ main: String::new(),
+ xmp_sidecar: String::new(),
+ jpeg: String::new(),
}
}
diff --git a/src/fwk/utils/exempi.rs b/src/fwk/utils/exempi.rs
index 0eaeb2d..4d36990 100644
--- a/src/fwk/utils/exempi.rs
+++ b/src/fwk/utils/exempi.rs
@@ -81,20 +81,18 @@ impl XmpMeta {
pub fn new() -> XmpMeta {
XmpMeta {
xmp: exempi::Xmp::new(),
- keywords: Vec::<String>::new(),
+ keywords: Vec::new(),
keywords_fetched: false,
}
}
pub fn new_from_file(file: &str, sidecar_only: bool) -> Option<XmpMeta> {
if !sidecar_only {
- let xmpfile = exempi::XmpFile::open_new(file, exempi::OPEN_READ);
- if xmpfile.is_some() {
- let xmp = xmpfile.unwrap().get_new_xmp();
- if xmp.is_some() {
+ if let Some(xmpfile) = exempi::XmpFile::open_new(file, exempi::OPEN_READ) {
+ if let Some(xmp) = xmpfile.get_new_xmp() {
return Some(XmpMeta {
- xmp: xmp.unwrap(),
- keywords: Vec::<String>::new(),
+ xmp: xmp,
+ keywords: Vec::new(),
keywords_fetched: false
});
}
@@ -111,7 +109,7 @@ impl XmpMeta {
if xmp.parse(sidecarcontent.into_bytes().as_slice()) {
return Some(XmpMeta {
xmp: xmp,
- keywords: Vec::<String>::new(),
+ keywords: Vec::new(),
keywords_fetched: false
});
}
@@ -297,7 +295,6 @@ pub extern "C" fn fwk_xmp_meta_get_rating(xmp: &XmpMeta) -> i32 {
0
}
-
#[no_mangle]
pub extern "C" fn fwk_xmp_meta_get_label(xmp: &XmpMeta) -> *mut c_char {
if let Some(s) = xmp.label() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]