From 5d7ae2af38869fae5f310db28185f32f2853e78a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 19 Feb 2024 19:34:41 +0000 Subject: [PATCH] WRONG BOUNDS --- src/main.rs | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index a552470..ba14590 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,28 +1,20 @@ use educe::Educe; -use std::fmt; +use std::fmt::{self, Debug}; -#[derive(Debug)] -pub struct Inner; - -impl Inner { - fn our_fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result { - Ok(()) - } +#[derive(Educe)] +#[educe(Debug(bound = "X: Debug"))] +pub struct Thing { + #[educe(Debug(method = "no_fmt"))] + field: Box, } -#[derive(Educe)] -#[educe(Debug(name = false))] -pub struct Thing { - #[educe(Debug(method = "Inner::our_fmt"))] - field: Inner, - #[educe(Debug(name(Q)))] - other: u32, +fn no_fmt(_: &Q, _f: &mut fmt::Formatter) -> fmt::Result { + Ok(()) } fn main() { let a = Thing { - field: Inner, - other: 6, + field: Box::new(42), }; println!("{:?}", &a); } -- 2.30.2