summaryrefslogtreecommitdiff
path: root/oryxc/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'oryxc/src/errors.rs')
-rw-r--r--oryxc/src/errors.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/oryxc/src/errors.rs b/oryxc/src/errors.rs
index 3c00220..e1f72cd 100644
--- a/oryxc/src/errors.rs
+++ b/oryxc/src/errors.rs
@@ -132,9 +132,10 @@ impl OryxError {
let errmid = new_string_with_spaces(&buffer[spanbeg..spanend]);
let errend = new_string_with_spaces(&buffer[spanend..lineend]);
- let errmid = match errmid.len() {
- 0 => "_".to_string(),
- _ => errmid,
+ let errmid = if errmid.len() == 0 {
+ "_".to_string()
+ } else {
+ errmid
};
/* TODO: Do tab math */
@@ -180,9 +181,10 @@ fn new_string_with_spaces(s: &str) -> String {
let ntabs = s.bytes().filter(|b| *b == b'\t').count();
let mut buf = String::with_capacity(s.len() + ntabs * (TABSIZE - 1));
for c in s.chars() {
- match c {
- '\t' => buf.push_str(TAB_AS_SPACES),
- _ => buf.push(c),
+ if c == '\t' {
+ buf.push_str(TAB_AS_SPACES);
+ } else {
+ buf.push(c);
}
}
return buf;