diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-03-26 13:56:36 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-03-26 13:56:36 +0100 |
commit | 34ce278af334fa5c49d460cd40a3f04558da3741 (patch) | |
tree | 793d67bd5a04ac841d9690ff9ac375880061dbd5 /libimagrt | |
parent | 7c276d541d90ba1fb05db67337b434f2397eef43 (diff) | |
parent | c53cc56d0cf6aab33b92b675af726302a300db19 (diff) |
Merge pull request #283 from matthiasbeyer/libimagrt/warning-to-error
Libimagrt/warning to error
Diffstat (limited to 'libimagrt')
-rw-r--r-- | libimagrt/src/configuration.rs | 6 | ||||
-rw-r--r-- | libimagrt/src/edit.rs | 3 | ||||
-rw-r--r-- | libimagrt/src/lib.rs | 14 | ||||
-rw-r--r-- | libimagrt/src/logger.rs | 2 |
4 files changed, 19 insertions, 6 deletions
diff --git a/libimagrt/src/configuration.rs b/libimagrt/src/configuration.rs index 995e4fb9..c4b3b31c 100644 --- a/libimagrt/src/configuration.rs +++ b/libimagrt/src/configuration.rs @@ -8,7 +8,7 @@ use toml::{Parser, Value}; */ pub mod error { use std::error::Error; - use std::fmt::{Debug, Display, Formatter}; + use std::fmt::{Display, Formatter}; use std::fmt::Error as FmtError; /** @@ -231,11 +231,11 @@ fn fetch_config(rtp: &PathBuf) -> Result<Value> { .map(|path| { let content = { let mut s = String::new(); - let mut f = File::open(path); + let f = File::open(path); if f.is_err() { } let mut f = f.unwrap(); - f.read_to_string(&mut s); + f.read_to_string(&mut s).ok(); s }; Parser::new(&content[..]).parse() diff --git a/libimagrt/src/edit.rs b/libimagrt/src/edit.rs index 8d1efd70..fb38bc54 100644 --- a/libimagrt/src/edit.rs +++ b/libimagrt/src/edit.rs @@ -41,8 +41,7 @@ pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> EditResult<()> { let file_path = file.path(); let mut file = try!(file.reopen()); - file.write_all(&s.clone().into_bytes()[..]); - + try!(file.write_all(&s.clone().into_bytes()[..])); try!(file.sync_data()); if let Some(mut editor) = rt.editor() { diff --git a/libimagrt/src/lib.rs b/libimagrt/src/lib.rs index 28fb6a1c..fdcd3b40 100644 --- a/libimagrt/src/lib.rs +++ b/libimagrt/src/lib.rs @@ -1,3 +1,17 @@ +#![deny( + non_camel_case_types, + non_snake_case, + path_statements, + trivial_numeric_casts, + unstable_features, + unused_allocation, + unused_import_braces, + unused_imports, + unused_mut, + unused_qualifications, + while_true, +)] + #[macro_use] extern crate log; #[macro_use] extern crate itertools; #[cfg(unix)] extern crate xdg_basedir; diff --git a/libimagrt/src/logger.rs b/libimagrt/src/logger.rs index a63b2423..181f3372 100644 --- a/libimagrt/src/logger.rs +++ b/libimagrt/src/logger.rs @@ -26,7 +26,7 @@ impl Log for ImagLogger { fn log(&self, record: &LogRecord) { if self.enabled(record.metadata()) { // TODO: This is just simple logging. Maybe we can enhance this lateron - writeln!(stderr(), "[imag][{: <5}]: {}", record.level(), record.args()); + writeln!(stderr(), "[imag][{: <5}]: {}", record.level(), record.args()).ok(); } } } |