Skip to content

Commit

Permalink
Debug printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Westerlind committed Dec 8, 2021
1 parent d80d5de commit 0845395
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ where

impl<'a, T, A> fmt::Display for Pretty<'a, '_, T, A>
where
T: DocPtr<'a, A> + std::fmt::Debug,
T: DocPtr<'a, A>,
Doc<'a, T, A>: std::fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.doc.render_fmt(self.width, f)
Expand All @@ -576,7 +577,8 @@ where

impl<'a, T, A> Doc<'a, T, A>
where
T: DocPtr<'a, A> + std::fmt::Debug + 'a,
T: DocPtr<'a, A> + 'a,
Doc<'a, T, A>: std::fmt::Debug,
{
/// Writes a rendered document to a `std::io::Write` object.
#[inline]
Expand Down
11 changes: 7 additions & 4 deletions src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,10 @@ where

pub fn best<'a, W, T, A>(doc: &Doc<'a, T, A>, width: usize, out: &mut W) -> Result<(), W::Error>
where
T: DocPtr<'a, A> + std::fmt::Debug + 'a,
T: DocPtr<'a, A> + 'a,
for<'b> W: RenderAnnotated<'b, A>,
W: ?Sized,
Doc<'a, T, A>: std::fmt::Debug,
{
let temp_arena = &typed_arena::Arena::new();
Best {
Expand Down Expand Up @@ -346,7 +347,8 @@ where

impl<'d, 'a, T, A> Best<'d, 'a, T, A>
where
T: DocPtr<'a, A> + std::fmt::Debug + 'a,
T: DocPtr<'a, A> + 'a,
Doc<'a, T, A>: std::fmt::Debug,
{
fn fitting(&mut self, next: &'d Doc<'a, T, A>, mut pos: usize, ind: usize) -> bool
where
Expand Down Expand Up @@ -460,12 +462,13 @@ where
Mode::Break => {
let fits = self.fitting(doc, self.pos, ind);
log::trace!(
"Fits {} {:?} {} {}: {:#?}",
"Fits {} {:?} {} {}: {:#?} {:#?}",
fits,
mode,
self.pos,
self.width,
doc
**doc,
self.bcmds,
);
if fits {
cmd.1 = Mode::Flat;
Expand Down

0 comments on commit 0845395

Please sign in to comment.