Skip to content

Commit 68a1700

Browse files
authored
Merge pull request #147 from KodrAus/cargo/0.7.1
Prepare for 0.7.1 release
2 parents 87496cf + e4a203b commit 68a1700

File tree

3 files changed

+32
-30
lines changed

3 files changed

+32
-30
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "env_logger"
33
edition = "2018"
4-
version = "0.7.0" # remember to update html_root_url
4+
version = "0.7.1" # remember to update html_root_url
55
authors = ["The Rust Project Developers"]
66
license = "MIT/Apache-2.0"
77
readme = "README.md"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It must be added along with `log` to the project dependencies:
1616
```toml
1717
[dependencies]
1818
log = "0.4.0"
19-
env_logger = "0.7.0"
19+
env_logger = "0.7.1"
2020
```
2121

2222
`env_logger` must be initialized as early as possible in the project. After it's initialized, you can use the `log` macros to do actual logging.
@@ -53,7 +53,7 @@ Tests can use the `env_logger` crate to see log messages generated during that t
5353
log = "0.4.0"
5454

5555
[dev-dependencies]
56-
env_logger = "0.7.0"
56+
env_logger = "0.7.1"
5757
```
5858

5959
```rust

src/lib.rs

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
#![doc(
238238
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
239239
html_favicon_url = "https://www.rust-lang.org/static/images/favicon.ico",
240-
html_root_url = "https://docs.rs/env_logger/0.7.0"
240+
html_root_url = "https://docs.rs/env_logger/0.7.1"
241241
)]
242242
#![cfg_attr(test, deny(warnings))]
243243
// When compiled for the rustc compiler itself we want to make sure that this is
@@ -808,41 +808,43 @@ impl Log for Logger {
808808
}
809809

810810
let print = |formatter: &mut Formatter, record: &Record| {
811-
let _ = (self.format)(formatter, record)
812-
.and_then(|_| formatter.print(&self.writer));
811+
let _ =
812+
(self.format)(formatter, record).and_then(|_| formatter.print(&self.writer));
813813

814814
// Always clear the buffer afterwards
815815
formatter.clear();
816816
};
817817

818-
let printed = FORMATTER.try_with(|tl_buf| {
819-
match tl_buf.try_borrow_mut() {
820-
// There are no active borrows of the buffer
821-
Ok(mut tl_buf) => match *tl_buf {
822-
// We have a previously set formatter
823-
Some(ref mut formatter) => {
824-
// Check the buffer style. If it's different from the logger's
825-
// style then drop the buffer and recreate it.
826-
if formatter.write_style() != self.writer.write_style() {
827-
*formatter = Formatter::new(&self.writer);
818+
let printed = FORMATTER
819+
.try_with(|tl_buf| {
820+
match tl_buf.try_borrow_mut() {
821+
// There are no active borrows of the buffer
822+
Ok(mut tl_buf) => match *tl_buf {
823+
// We have a previously set formatter
824+
Some(ref mut formatter) => {
825+
// Check the buffer style. If it's different from the logger's
826+
// style then drop the buffer and recreate it.
827+
if formatter.write_style() != self.writer.write_style() {
828+
*formatter = Formatter::new(&self.writer);
829+
}
830+
831+
print(formatter, record);
828832
}
833+
// We don't have a previously set formatter
834+
None => {
835+
let mut formatter = Formatter::new(&self.writer);
836+
print(&mut formatter, record);
829837

830-
print(formatter, record);
831-
}
832-
// We don't have a previously set formatter
833-
None => {
834-
let mut formatter = Formatter::new(&self.writer);
835-
print(&mut formatter, record);
836-
837-
*tl_buf = Some(formatter);
838+
*tl_buf = Some(formatter);
839+
}
840+
},
841+
// There's already an active borrow of the buffer (due to re-entrancy)
842+
Err(_) => {
843+
print(&mut Formatter::new(&self.writer), record);
838844
}
839845
}
840-
// There's already an active borrow of the buffer (due to re-entrancy)
841-
Err(_) => {
842-
print(&mut Formatter::new(&self.writer), record);
843-
}
844-
}
845-
}).is_ok();
846+
})
847+
.is_ok();
846848

847849
if !printed {
848850
// The thread-local storage was not available (because its

0 commit comments

Comments
 (0)