diff options
| author | Steven Fackler <sfackler@gmail.com> | 2015-03-07 19:36:36 -0800 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2015-03-09 23:24:34 -0700 |
| commit | bd6ed22fdf3df4e47d418487320a47d308c4477e (patch) | |
| tree | 429b2d1e40f2470141a1e956bb89a39935d8b546 /src/libcore | |
| parent | 8121cf077c68fa1d18a1a538deb5acdf79c5e732 (diff) | |
| download | rust-bd6ed22fdf3df4e47d418487320a47d308c4477e.tar.gz rust-bd6ed22fdf3df4e47d418487320a47d308c4477e.zip | |
Switch derive(Debug) to use the debug builders
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/fmt/builders.rs | 18 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 6 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index d96da4cafb0..37165cdc5ed 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -1,3 +1,13 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + use prelude::*; use fmt::{self, Write, FlagV1}; @@ -69,6 +79,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> { self } + #[inline(never)] fn field_inner(&mut self, name: &str, value: &fmt::Debug) { self.result = self.result.and_then(|_| { let prefix = if self.has_fields { @@ -97,6 +108,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> { self.result } + #[inline(never)] fn finish_inner(&mut self) { if self.has_fields { self.result = self.result.and_then(|_| { @@ -142,6 +154,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> { self } + #[inline(never)] fn field_inner(&mut self, value: &fmt::Debug) { self.result = self.result.and_then(|_| { let (prefix, space) = if self.has_fields { @@ -170,6 +183,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> { self.result } + #[inline(never)] fn finish_inner(&mut self) { if self.has_fields { self.result = self.result.and_then(|_| { @@ -215,6 +229,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> { self } + #[inline(never)] fn entry_inner(&mut self, entry: &fmt::Debug) { self.result = self.result.and_then(|_| { let prefix = if self.has_fields { @@ -243,6 +258,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> { self.result } + #[inline(never)] fn finish_inner(&mut self) { self.result = self.result.and_then(|_| { let end = match (self.has_fields, self.is_pretty()) { @@ -287,6 +303,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { self } + #[inline(never)] fn entry_inner(&mut self, key: &fmt::Debug, value: &fmt::Debug) { self.result = self.result.and_then(|_| { let prefix = if self.has_fields { @@ -315,6 +332,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { self.result } + #[inline(never)] fn finish_inner(&mut self) { self.result = self.result.and_then(|_| { let end = match (self.has_fields, self.is_pretty()) { diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 572d613f192..741cf7b47fa 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -644,6 +644,7 @@ impl<'a> Formatter<'a> { /// println!("{:?}", Foo { bar: 10, baz: "Hello World".to_string() }); /// ``` #[unstable(feature = "core", reason = "method was just created")] + #[inline] pub fn debug_struct<'b>(&'b mut self, name: &str) -> DebugStruct<'b, 'a> { builders::debug_struct_new(self, name) } @@ -671,6 +672,7 @@ impl<'a> Formatter<'a> { /// println!("{:?}", Foo(10, "Hello World".to_string())); /// ``` #[unstable(feature = "core", reason = "method was just created")] + #[inline] pub fn debug_tuple<'b>(&'b mut self, name: &str) -> DebugTuple<'b, 'a> { builders::debug_tuple_new(self, name) } @@ -699,6 +701,7 @@ impl<'a> Formatter<'a> { /// println!("{:?}", Foo(vec![10, 11])); /// ``` #[unstable(feature = "core", reason = "method was just created")] + #[inline] pub fn debug_set<'b>(&'b mut self, name: &str) -> DebugSet<'b, 'a> { builders::debug_set_new(self, name) } @@ -724,9 +727,10 @@ impl<'a> Formatter<'a> { /// } /// /// // prints "Foo { "A": 10, "B": 11 }" - /// println!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11))); + /// println!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])); /// ``` #[unstable(feature = "core", reason = "method was just created")] + #[inline] pub fn debug_map<'b>(&'b mut self, name: &str) -> DebugMap<'b, 'a> { builders::debug_map_new(self, name) } |
