diff options
author | Rory Dudley | 2024-09-02 22:23:01 -0600 |
---|---|---|
committer | Rory Dudley | 2024-09-02 22:36:15 -0600 |
commit | 51fcf2efdaae8bdd5270cfe64de1522eadd1775f (patch) | |
tree | c8022679dfea1351b5aabe15d37a1415d40c62e8 /src/poem/elements/verse.rs | |
parent | 49676c0e1c5fd0660edfd73cfd97001a00b7bd8b (diff) | |
download | dwarvish-51fcf2efdaae8bdd5270cfe64de1522eadd1775f.tar.gz |
Refactor Verse::clause()
There is no reason to return an option for clause(), since it makes us
perform a match twice, and since a blank vector is perfectly acceptable
in all cases where the verse at hand may not have a clause.
Signed-off-by: Rory Dudley <rory@netc.lu>
Diffstat (limited to 'src/poem/elements/verse.rs')
-rw-r--r-- | src/poem/elements/verse.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/poem/elements/verse.rs b/src/poem/elements/verse.rs index 1c5bcc1..9ebd31d 100644 --- a/src/poem/elements/verse.rs +++ b/src/poem/elements/verse.rs @@ -140,11 +140,11 @@ impl Verse { /// Get the [Verse]'s clause /// /// Return program arguments, if they exist - pub fn clause(&self) -> Option<Vec<String>> { + pub fn clause(&self) -> Vec<String> { match self.stanza.len() { - 0 => None, - 1 => None, - _ => Some(self.stanza[1..].to_vec()), + 0 => vec![], + 1 => vec![], + _ => self.stanza[1..].to_vec(), } } |