diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-08-02 15:48:01 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-08-02 15:59:31 +0200 |
commit | f6dbb622df0cbc2b01f1b52812d7f527800588c8 (patch) | |
tree | 2b3a99fccd101c5db7ecb8e3f7e43532185c6860 /src/cell.rs | |
parent | abd70567956c3f8c76188d26d9d59bf6838f613d (diff) |
Replace match with mapping
Diffstat (limited to 'src/cell.rs')
-rw-r--r-- | src/cell.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/cell.rs b/src/cell.rs index 4b917a8..29aa3e3 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -175,10 +175,7 @@ impl Cell { /// fill the cells with blanks so it fits in the table.
/// If `ìdx` is higher than this cell's height, it will print empty content
pub fn print<T: Write+?Sized>(&self, out: &mut T, idx: usize, col_width: usize, skip_right_fill: bool) -> Result<(), Error> {
- let c = match self.content.get(idx) {
- Some(s) => s.as_ref(),
- None => ""
- };
+ let c = self.content.get(idx).map(|s| s.as_ref()).unwrap_or("");
print_align(out, self.align, c, ' ', col_width, skip_right_fill)
}
|