summaryrefslogtreecommitdiffstats
path: root/libimagentrylink
diff options
context:
space:
mode:
authorAndre Bogus <bogusandre@gmail.com>2016-05-03 23:10:32 +0200
committerAndre Bogus <bogusandre@gmail.com>2016-05-13 22:27:53 +0200
commit981707c9c959668e09f83926f6dafa296e84ebf0 (patch)
treeb534d8acea0c0a7d0b27c81963fe62e075f1709b /libimagentrylink
parent7a46df312549d6bf97b6ebcb40599061c57ca55e (diff)
more style adaptations
again following clippy
Diffstat (limited to 'libimagentrylink')
-rw-r--r--libimagentrylink/src/error.rs18
-rw-r--r--libimagentrylink/src/external.rs8
-rw-r--r--libimagentrylink/src/internal.rs6
3 files changed, 16 insertions, 16 deletions
diff --git a/libimagentrylink/src/error.rs b/libimagentrylink/src/error.rs
index bdf7ccb1..a26e3d58 100644
--- a/libimagentrylink/src/error.rs
+++ b/libimagentrylink/src/error.rs
@@ -15,29 +15,29 @@ pub enum LinkErrorKind {
}
fn link_error_type_as_str(e: &LinkErrorKind) -> &'static str {
- match e {
- &LinkErrorKind::EntryHeaderReadError
+ match *e {
+ LinkErrorKind::EntryHeaderReadError
=> "Error while reading an entry header",
- &LinkErrorKind::EntryHeaderWriteError
+ LinkErrorKind::EntryHeaderWriteError
=> "Error while writing an entry header",
- &LinkErrorKind::ExistingLinkTypeWrong
+ LinkErrorKind::ExistingLinkTypeWrong
=> "Existing link entry has wrong type",
- &LinkErrorKind::LinkTargetDoesNotExist
+ LinkErrorKind::LinkTargetDoesNotExist
=> "Link target does not exist in the store",
- &LinkErrorKind::InternalConversionError
+ LinkErrorKind::InternalConversionError
=> "Error while converting values internally",
- &LinkErrorKind::InvalidUri
+ LinkErrorKind::InvalidUri
=> "URI is not valid",
- &LinkErrorKind::StoreReadError
+ LinkErrorKind::StoreReadError
=> "Store read error",
- &LinkErrorKind::StoreWriteError
+ LinkErrorKind::StoreWriteError
=> "Store write error",
}
}
diff --git a/libimagentrylink/src/external.rs b/libimagentrylink/src/external.rs
index fb791b9e..486ab306 100644
--- a/libimagentrylink/src/external.rs
+++ b/libimagentrylink/src/external.rs
@@ -31,7 +31,7 @@ use url::Url;
use crypto::sha1::Sha1;
use crypto::digest::Digest;
-/// "Link" Type, just an abstraction over FileLockEntry to have some convenience internally.
+/// "Link" Type, just an abstraction over `FileLockEntry` to have some convenience internally.
struct Link<'a> {
link: FileLockEntry<'a>
}
@@ -57,7 +57,7 @@ impl<'a> Link<'a> {
.map_err(|e| LE::new(LEK::StoreReadError, Some(Box::new(e))))
}
- /// Get a link Url object from a FileLockEntry, ignore errors.
+ /// Get a link Url object from a `FileLockEntry`, ignore errors.
fn get_link_uri_from_filelockentry(file: &FileLockEntry<'a>) -> Option<Url> {
file.get_header()
.read("imag.content.uri")
@@ -78,7 +78,7 @@ impl<'a> Link<'a> {
match opt {
Ok(Some(Value::String(s))) => {
Url::parse(&s[..])
- .map(|s| Some(s))
+ .map(Some)
.map_err(|e| LE::new(LEK::EntryHeaderReadError, Some(Box::new(e))))
},
Ok(None) => Ok(None),
@@ -115,7 +115,7 @@ fn get_external_link_from_file(entry: &FileLockEntry) -> Result<Url> {
.ok_or(LE::new(LEK::StoreReadError, None))
}
-/// Implement ExternalLinker for Entry, hiding the fact that there is no such thing as an external
+/// Implement `ExternalLinker` for `Entry`, hiding the fact that there is no such thing as an external
/// link in an entry, but internal links to other entries which serve as external links, as one
/// entry in the store can only have one external link.
impl ExternalLinker for Entry {
diff --git a/libimagentrylink/src/internal.rs b/libimagentrylink/src/internal.rs
index a410349a..16186ddb 100644
--- a/libimagentrylink/src/internal.rs
+++ b/libimagentrylink/src/internal.rs
@@ -92,9 +92,9 @@ impl InternalLinker for Entry {
fn links_into_values(links: Vec<StoreId>) -> Vec<Option<Value>> {
links
.into_iter()
- .map(|s| s.to_str().map(|s| String::from(s)))
+ .map(|s| s.to_str().map(String::from))
.unique()
- .map(|elem| elem.map(|s| Value::String(s)))
+ .map(|elem| elem.map(Value::String))
.sorted_by(|a, b| {
match (a, b) {
(&Some(Value::String(ref a)), &Some(Value::String(ref b))) => Ord::cmp(a, b),
@@ -160,7 +160,7 @@ fn process_rw_result(links: StoreResult<Option<Value>>) -> Result<Vec<Link>> {
}
};
- if !links.iter().all(|l| match l { &Value::String(_) => true, _ => false }) {
+ if !links.iter().all(|l| match *l { Value::String(_) => true, _ => false }) {
debug!("At least one of the Values which were expected in the Array of links is a non-String!");
debug!("Generating LinkError");
return Err(LinkError::new(LinkErrorKind::ExistingLinkTypeWrong, None));