|
237 | 237 | #![doc(
|
238 | 238 | html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
239 | 239 | 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" |
241 | 241 | )]
|
242 | 242 | #![cfg_attr(test, deny(warnings))]
|
243 | 243 | // When compiled for the rustc compiler itself we want to make sure that this is
|
@@ -808,41 +808,43 @@ impl Log for Logger {
|
808 | 808 | }
|
809 | 809 |
|
810 | 810 | 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)); |
813 | 813 |
|
814 | 814 | // Always clear the buffer afterwards
|
815 | 815 | formatter.clear();
|
816 | 816 | };
|
817 | 817 |
|
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); |
828 | 832 | }
|
| 833 | + // We don't have a previously set formatter |
| 834 | + None => { |
| 835 | + let mut formatter = Formatter::new(&self.writer); |
| 836 | + print(&mut formatter, record); |
829 | 837 |
|
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); |
838 | 844 | }
|
839 | 845 | }
|
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(); |
846 | 848 |
|
847 | 849 | if !printed {
|
848 | 850 | // The thread-local storage was not available (because its
|
|
0 commit comments