Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up the build on nightly compilers #135

Merged
merged 1 commit into from
Jun 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/filters_from_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ Specify logging filters in code instead of using an environment variable.
extern crate log;
extern crate env_logger;

use env_logger::Env;

fn main() {
env_logger::builder()
.filter_level(log::LevelFilter::Trace)
Expand Down
4 changes: 3 additions & 1 deletion src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub(crate) struct Builder {
pub default_format_timestamp_nanos: bool,
pub default_format_module_path: bool,
pub default_format_level: bool,
#[allow(unknown_lints, bare_trait_objects)]
pub custom_format: Option<Box<Fn(&mut Formatter, &Record) -> io::Result<()> + Sync + Send>>,
built: bool,
}
Expand All @@ -140,6 +141,7 @@ impl Builder {
/// If the `custom_format` is `Some`, then any `default_format` switches are ignored.
/// If the `custom_format` is `None`, then a default format is returned.
/// Any `default_format` switches set to `false` won't be written by the format.
#[allow(unknown_lints, bare_trait_objects)]
pub fn build(&mut self) -> Box<Fn(&mut Formatter, &Record) -> io::Result<()> + Sync + Send> {
assert!(!self.built, "attempt to re-use consumed builder");

Expand Down Expand Up @@ -353,4 +355,4 @@ mod tests {

assert_eq!("log message\n", written);
}
}
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ struct Var<'a> {
pub struct Logger {
writer: Writer,
filter: Filter,
#[allow(unknown_lints, bare_trait_objects)]
format: Box<Fn(&mut Formatter, &Record) -> io::Result<()> + Sync + Send>,
}

Expand Down