From 803ea7605937f3f452c38dc17c66d73049a7ba00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastian=20K=C3=B6cher?= <git@kchr.de>
Date: Fri, 24 Nov 2023 15:20:21 +0100
Subject: [PATCH] Improve `UnpinHandleInner` debug (#2485)

Printing the `unpin_worker_sender` included the entire stacktrace and
that is a little bit too verbose.
---
 substrate/client/api/src/client.rs | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/substrate/client/api/src/client.rs b/substrate/client/api/src/client.rs
index e334f2f9fb4..46232c74539 100644
--- a/substrate/client/api/src/client.rs
+++ b/substrate/client/api/src/client.rs
@@ -25,7 +25,11 @@ use sp_runtime::{
 	traits::{Block as BlockT, NumberFor},
 	Justifications,
 };
-use std::{collections::HashSet, fmt, sync::Arc};
+use std::{
+	collections::HashSet,
+	fmt::{self, Debug},
+	sync::Arc,
+};
 
 use crate::{blockchain::Info, notifications::StorageEventStream, FinalizeSummary, ImportSummary};
 
@@ -271,13 +275,18 @@ impl fmt::Display for UsageInfo {
 }
 
 /// Sends a message to the pinning-worker once dropped to unpin a block in the backend.
-#[derive(Debug)]
 pub struct UnpinHandleInner<Block: BlockT> {
 	/// Hash of the block pinned by this handle
 	hash: Block::Hash,
 	unpin_worker_sender: TracingUnboundedSender<Block::Hash>,
 }
 
+impl<Block: BlockT> Debug for UnpinHandleInner<Block> {
+	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+		f.debug_struct("UnpinHandleInner").field("pinned_block", &self.hash).finish()
+	}
+}
+
 impl<Block: BlockT> UnpinHandleInner<Block> {
 	/// Create a new [`UnpinHandleInner`]
 	pub fn new(
-- 
GitLab