diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cell.rs | 4 | ||||
-rw-r--r-- | src/format.rs | 6 | ||||
-rw-r--r-- | src/row.rs | 2 | ||||
-rw-r--r-- | src/utils.rs | 10 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/cell.rs b/src/cell.rs index 29aa3e3..beb6a4a 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -31,12 +31,12 @@ impl Cell { width = l;
}
}
- return Cell {
+ Cell {
content: content,
width: width,
align: align,
style: Vec::new()
- };
+ }
}
/// Create a new `Cell` initialized with content from `string`.
diff --git a/src/format.rs b/src/format.rs index ae72e59..d0d816e 100644 --- a/src/format.rs +++ b/src/format.rs @@ -6,7 +6,7 @@ use super::utils::NEWLINE; /// Alignment for cell's content
#[derive(Clone, Debug, PartialEq, Copy)]
-pub enum Alignment {
+pub enum Alignment {
LEFT,
CENTER,
RIGHT
@@ -155,7 +155,7 @@ impl TableFormat { }
fn get_sep_for_line(&self, pos: LinePosition) -> &Option<LineSeparator> {
- return match pos {
+ match pos {
LinePosition::Intern => return &self.lsep,
LinePosition::Top => return &self.top_sep,
LinePosition::Bottom => return &self.bottom_sep,
@@ -163,7 +163,7 @@ impl TableFormat { s @ &Some(_) => s,
&None => &self.lsep
}
- };
+ }
}
/// Print a full line separator to `out`. `col_width` is a slice containing the width of each column
@@ -76,7 +76,7 @@ impl Row { self.cells.push(cell);
}
- /// Insert `cell` at position `index`. If `index` is higher than the row lenght,
+ /// Insert `cell` at position `index`. If `index` is higher than the row length,
/// the cell will be appended at the end
pub fn insert_cell(&mut self, index: usize, cell: Cell) {
if index < self.cells.len() {
diff --git a/src/utils.rs b/src/utils.rs index 5326920..121840e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -19,12 +19,12 @@ pub struct StringWriter { impl StringWriter {
/// Create a new `StringWriter`
pub fn new() -> StringWriter {
- return StringWriter{string: String::new()};
+ StringWriter{string: String::new()}
}
/// Return a reference to the internally written `String`
pub fn as_string(&self) -> &str {
- return &self.string;
+ &self.string
}
}
@@ -35,12 +35,12 @@ impl Write for StringWriter { Err(e) => return Err(Error::new(ErrorKind::Other, format!("Cannot decode utf8 string : {}", e)))
};
self.string.push_str(string);
- return Ok(data.len());
+ Ok(data.len())
}
fn flush(&mut self) -> Result<(), Error> {
// Nothing to do here
- return Ok(());
+ Ok(())
}
}
@@ -63,7 +63,7 @@ pub fn print_align<T: Write+?Sized>(out: &mut T, align: Alignment, text: &str, f if nfill > 0 && ! skip_right_fill {
try!(out.write(&vec![fill as u8; nfill]));
}
- return Ok(());
+ Ok(())
}
#[cfg(test)]
|