Skip to content

Commit

Permalink
feat: add no-span-debug feature for omitting span for debug purposes (F…
Browse files Browse the repository at this point in the history
  • Loading branch information
kayagokalp authored Nov 28, 2022
1 parent 943b355 commit 0b843cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sway-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ fuel-crypto = "0.6"
fuel-tx = "0.23"
lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] }

[features]
no-span-debug = []
5 changes: 5 additions & 0 deletions sway-types/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ impl Span {
}

impl fmt::Debug for Span {
#[cfg(not(feature = "no-span-debug"))]
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("Span")
.field("src (ptr)", &self.src.as_ptr())
Expand All @@ -200,6 +201,10 @@ impl fmt::Debug for Span {
.field("as_str()", &self.as_str())
.finish()
}
#[cfg(feature = "no-span-debug")]
fn fmt(&self, _fmt: &mut fmt::Formatter) -> fmt::Result {
Ok(())
}
}

pub trait Spanned {
Expand Down

0 comments on commit 0b843cd

Please sign in to comment.