From 27845072ae555e40e89cb5877aecee814b8613fe Mon Sep 17 00:00:00 2001 From: Stiopa Koltsov Date: Tue, 9 Jan 2024 21:20:00 -0800 Subject: [PATCH] format_code_in_doc_comments = true Summary: D52632085 Reviewed By: dtolnay Differential Revision: D52644229 fbshipit-source-id: 5acf67f9fae4e28beac55f9c7f07c4f4e8bb43e6 --- allocative/allocative/src/flamegraph.rs | 12 ++++++++---- allocative/allocative/src/size_of.rs | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/allocative/allocative/src/flamegraph.rs b/allocative/allocative/src/flamegraph.rs index 897206817..30cb7006d 100644 --- a/allocative/allocative/src/flamegraph.rs +++ b/allocative/allocative/src/flamegraph.rs @@ -281,18 +281,22 @@ unsafe impl Send for VisitedSharedPointer {} /// # Example /// /// ``` -/// use allocative::FlameGraphBuilder; /// use allocative::Allocative; +/// use allocative::FlameGraphBuilder; /// /// #[derive(Allocative)] /// struct Foo { /// data: String, /// }; /// -/// let foo1 = Foo { data: "Hello, world!".to_owned() }; -/// let foo2 = Foo { data: "Another message!".to_owned() }; +/// let foo1 = Foo { +/// data: "Hello, world!".to_owned(), +/// }; +/// let foo2 = Foo { +/// data: "Another message!".to_owned(), +/// }; /// -/// let mut flamegraph = FlameGraphBuilder::default(); +/// let mut flamegraph = FlameGraphBuilder::default(); /// flamegraph.visit_root(&foo1); /// flamegraph.visit_root(&foo2); /// let flamegraph_src = flamegraph.finish().flamegraph(); diff --git a/allocative/allocative/src/size_of.rs b/allocative/allocative/src/size_of.rs index 1662e0730..b31110d94 100644 --- a/allocative/allocative/src/size_of.rs +++ b/allocative/allocative/src/size_of.rs @@ -29,7 +29,12 @@ use crate::Visitor; /// data: Vec, /// } /// -/// assert_eq!(3, allocative::size_of_unique_allocated_data(&Foo { data: vec![10, 20, 30] })); +/// assert_eq!( +/// 3, +/// allocative::size_of_unique_allocated_data(&Foo { +/// data: vec![10, 20, 30] +/// }) +/// ); /// ``` pub fn size_of_unique_allocated_data(root: &dyn Allocative) -> usize { struct SizeOfUniqueAllocatedDataVisitor { @@ -91,7 +96,12 @@ pub fn size_of_unique_allocated_data(root: &dyn Allocative) -> usize { /// data: Vec, /// } /// -/// assert_eq!(3 + std::mem::size_of::>(), allocative::size_of_unique(&Foo { data: vec![10, 20, 30] })); +/// assert_eq!( +/// 3 + std::mem::size_of::>(), +/// allocative::size_of_unique(&Foo { +/// data: vec![10, 20, 30] +/// }) +/// ); /// ``` pub fn size_of_unique(root: &T) -> usize where