summaryrefslogtreecommitdiff
path: root/src/metadata.rs
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2021-05-20 00:25:42 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2021-05-20 00:25:42 +0100
commit6bf39fdb44dcbcd29c13b71aaa22c01b4741ec51 (patch)
treed9555b2e58ba198fcd9f3128e9681ca0d5457b31 /src/metadata.rs
parente762e23a9ac7b36c6abfc8c45d1b48407263007f (diff)
downloadsubplot-6bf39fdb44dcbcd29c13b71aaa22c01b4741ec51.tar.gz
chore: Fix a bunch of clippy lints
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'src/metadata.rs')
-rw-r--r--src/metadata.rs17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/metadata.rs b/src/metadata.rs
index 3f4916a..8406e38 100644
--- a/src/metadata.rs
+++ b/src/metadata.rs
@@ -63,11 +63,7 @@ impl Metadata {
/// Return date of document, if any.
pub fn date(&self) -> Option<&str> {
- if let Some(date) = &self.date {
- Some(&date)
- } else {
- None
- }
+ self.date.as_deref()
}
/// Return filename where bindings are specified.
@@ -85,10 +81,7 @@ impl Metadata {
/// Return the name of the code template, if specified.
pub fn template_name(&self) -> Option<&str> {
- match &self.template {
- Some(x) => Some(&x),
- None => None,
- }
+ self.template.as_deref()
}
/// Return the bindings.
@@ -118,11 +111,7 @@ fn get_title(map: &Mapp) -> String {
}
fn get_date(map: &Mapp) -> Option<String> {
- if let Some(s) = get_string(map, "date") {
- Some(s)
- } else {
- None
- }
+ get_string(map, "date")
}
fn get_bindings_filenames<P>(basedir: P, map: &Mapp) -> Vec<PathBuf>