Add cargo fmt
to .travis.yml (#474)
* Run cargo fmt * Add cargo fmt to travis.yml
This commit is contained in:
parent
309b10c4a8
commit
7738d51a72
@ -11,6 +11,7 @@ before_install:
|
|||||||
- sudo chown -R $USER /usr/local/include/google
|
- sudo chown -R $USER /usr/local/include/google
|
||||||
script:
|
script:
|
||||||
- cargo build --verbose --all --release
|
- cargo build --verbose --all --release
|
||||||
|
- cargo fmt --all -- --check
|
||||||
rust:
|
rust:
|
||||||
- beta
|
- beta
|
||||||
- nightly
|
- nightly
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::io::{Write, Result};
|
use std::io::{Result, Write};
|
||||||
|
|
||||||
pub const MAX_MESSAGE_WIDTH: usize = 40;
|
pub const MAX_MESSAGE_WIDTH: usize = 40;
|
||||||
|
|
||||||
@ -17,9 +17,15 @@ impl AlignedTermDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl slog_term::Decorator for AlignedTermDecorator {
|
impl slog_term::Decorator for AlignedTermDecorator {
|
||||||
fn with_record<F>(&self, _record: &slog::Record, _logger_values: &slog::OwnedKVList, f: F)
|
fn with_record<F>(
|
||||||
-> Result<()> where
|
&self,
|
||||||
F: FnOnce(&mut dyn slog_term::RecordDecorator) -> std::io::Result<()> {
|
_record: &slog::Record,
|
||||||
|
_logger_values: &slog::OwnedKVList,
|
||||||
|
f: F,
|
||||||
|
) -> Result<()>
|
||||||
|
where
|
||||||
|
F: FnOnce(&mut dyn slog_term::RecordDecorator) -> std::io::Result<()>,
|
||||||
|
{
|
||||||
self.wrapped.with_record(_record, _logger_values, |deco| {
|
self.wrapped.with_record(_record, _logger_values, |deco| {
|
||||||
f(&mut AlignedRecordDecorator::new(deco, self.message_width))
|
f(&mut AlignedRecordDecorator::new(deco, self.message_width))
|
||||||
})
|
})
|
||||||
@ -35,8 +41,10 @@ struct AlignedRecordDecorator<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> AlignedRecordDecorator<'a> {
|
impl<'a> AlignedRecordDecorator<'a> {
|
||||||
fn new(decorator: &'a mut dyn slog_term::RecordDecorator, message_width: usize) ->
|
fn new(
|
||||||
AlignedRecordDecorator<'a> {
|
decorator: &'a mut dyn slog_term::RecordDecorator,
|
||||||
|
message_width: usize,
|
||||||
|
) -> AlignedRecordDecorator<'a> {
|
||||||
AlignedRecordDecorator {
|
AlignedRecordDecorator {
|
||||||
wrapped: decorator,
|
wrapped: decorator,
|
||||||
message_count: 0,
|
message_count: 0,
|
||||||
@ -103,8 +111,13 @@ impl<'a> slog_term::RecordDecorator for AlignedRecordDecorator<'a> {
|
|||||||
|
|
||||||
fn start_key(&mut self) -> Result<()> {
|
fn start_key(&mut self) -> Result<()> {
|
||||||
if self.message_active && self.message_count + 1 < self.message_width {
|
if self.message_active && self.message_count + 1 < self.message_width {
|
||||||
write!(self, "{}", std::iter::repeat(' ').take(self.message_width - self.message_count)
|
write!(
|
||||||
.collect::<String>())?;
|
self,
|
||||||
|
"{}",
|
||||||
|
std::iter::repeat(' ')
|
||||||
|
.take(self.message_width - self.message_count)
|
||||||
|
.collect::<String>()
|
||||||
|
)?;
|
||||||
self.message_active = false;
|
self.message_active = false;
|
||||||
self.message_count = 0;
|
self.message_count = 0;
|
||||||
self.ignore_comma = false;
|
self.ignore_comma = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user