summaryrefslogtreecommitdiff
path: root/src/logging.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-03-30 16:48:36 +0000
committerGitHub <noreply@github.com>2019-03-30 16:48:36 +0000
commitcfd025b5289bc305470a96657868c982a2b13bc2 (patch)
tree093b9105c881e28b909e031c46d2054016b643b3 /src/logging.rs
parent91aa683bcd060b2ac2f621a388a6448f564d0537 (diff)
downloadalacritty-cfd025b5289bc305470a96657868c982a2b13bc2.tar.gz
alacritty-cfd025b5289bc305470a96657868c982a2b13bc2.zip
Add rustfmt style guidev0.3.0-rc1
Diffstat (limited to 'src/logging.rs')
-rw-r--r--src/logging.rs27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/logging.rs b/src/logging.rs
index 0b1d25a4..c6ddd8e6 100644
--- a/src/logging.rs
+++ b/src/logging.rs
@@ -68,12 +68,7 @@ impl Logger {
let logfile = Mutex::new(OnDemandLogFile::new());
let stdout = Mutex::new(LineWriter::new(io::stdout()));
- Logger {
- level,
- logfile,
- stdout,
- message_tx,
- }
+ Logger { level, logfile, stdout, message_tx }
}
fn file_path(&self) -> Option<PathBuf> {
@@ -100,10 +95,7 @@ impl log::Log for Logger {
now,
record.level(),
record.file().unwrap_or("?"),
- record
- .line()
- .map(|l| l.to_string())
- .unwrap_or_else(|| "?".into()),
+ record.line().map(|l| l.to_string()).unwrap_or_else(|| "?".into()),
record.args()
)
} else {
@@ -161,11 +153,7 @@ impl OnDemandLogFile {
// Set log path as an environment variable
env::set_var(ALACRITTY_LOG_ENV, path.as_os_str());
- OnDemandLogFile {
- path,
- file: None,
- created: Arc::new(AtomicBool::new(false)),
- }
+ OnDemandLogFile { path, file: None, created: Arc::new(AtomicBool::new(false)) }
}
fn file(&mut self) -> Result<&mut LineWriter<File>, io::Error> {
@@ -176,21 +164,18 @@ impl OnDemandLogFile {
// Create the file if it doesn't exist yet
if self.file.is_none() {
- let file = OpenOptions::new()
- .append(true)
- .create(true)
- .open(&self.path);
+ let file = OpenOptions::new().append(true).create(true).open(&self.path);
match file {
Ok(file) => {
self.file = Some(io::LineWriter::new(file));
self.created.store(true, Ordering::Relaxed);
let _ = writeln!(io::stdout(), "Created log file at {:?}", self.path);
- }
+ },
Err(e) => {
let _ = writeln!(io::stdout(), "Unable to create log file: {}", e);
return Err(e);
- }
+ },
}
}