diff --git a/crates/base-db/src/span.rs b/crates/base-db/src/span.rs index a78f558759b0..e183e9b19965 100644 --- a/crates/base-db/src/span.rs +++ b/crates/base-db/src/span.rs @@ -102,7 +102,7 @@ impl fmt::Debug for HirFileId { } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct MacroFile { +pub struct MacroFileId { pub macro_call_id: MacroCallId, } /// `MacroCallId` identifies a particular macro invocation, like @@ -113,18 +113,18 @@ crate::impl_intern_key!(MacroCallId); impl MacroCallId { pub fn as_file(self) -> HirFileId { - MacroFile { macro_call_id: self }.into() + MacroFileId { macro_call_id: self }.into() } - pub fn as_macro_file(self) -> MacroFile { - MacroFile { macro_call_id: self } + pub fn as_macro_file(self) -> MacroFileId { + MacroFileId { macro_call_id: self } } } #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub enum HirFileIdRepr { FileId(FileId), - MacroFile(MacroFile), + MacroFile(MacroFileId), } impl fmt::Debug for HirFileIdRepr { @@ -145,8 +145,8 @@ impl From for HirFileId { } } -impl From for HirFileId { - fn from(MacroFile { macro_call_id: MacroCallId(id) }: MacroFile) -> Self { +impl From for HirFileId { + fn from(MacroFileId { macro_call_id: MacroCallId(id) }: MacroFileId) -> Self { let id = id.as_u32(); assert!(id < Self::MAX_FILE_ID); HirFileId(id | Self::MACRO_FILE_TAG_MASK) @@ -163,10 +163,10 @@ impl HirFileId { } #[inline] - pub fn macro_file(self) -> Option { + pub fn macro_file(self) -> Option { match self.0 & Self::MACRO_FILE_TAG_MASK { 0 => None, - _ => Some(MacroFile { + _ => Some(MacroFileId { macro_call_id: MacroCallId(InternId::from(self.0 ^ Self::MACRO_FILE_TAG_MASK)), }), } @@ -184,7 +184,7 @@ impl HirFileId { pub fn repr(self) -> HirFileIdRepr { match self.0 & Self::MACRO_FILE_TAG_MASK { 0 => HirFileIdRepr::FileId(FileId(self.0)), - _ => HirFileIdRepr::MacroFile(MacroFile { + _ => HirFileIdRepr::MacroFile(MacroFileId { macro_call_id: MacroCallId(InternId::from(self.0 ^ Self::MACRO_FILE_TAG_MASK)), }), } diff --git a/crates/hir-def/src/macro_expansion_tests/mod.rs b/crates/hir-def/src/macro_expansion_tests/mod.rs index 27ec63d171b0..355b82a5f42c 100644 --- a/crates/hir-def/src/macro_expansion_tests/mod.rs +++ b/crates/hir-def/src/macro_expansion_tests/mod.rs @@ -18,7 +18,7 @@ use std::{iter, ops::Range, sync}; use base_db::{fixture::WithFixture, ProcMacro, SourceDatabase}; use expect_test::Expect; -use hir_expand::{db::ExpandDatabase, span::SpanMapRef, HirFileIdExt, InFile, MacroFile}; +use hir_expand::{db::ExpandDatabase, span::SpanMapRef, HirFileIdExt, InFile, MacroFileId}; use stdx::format_to; use syntax::{ ast::{self, edit::IndentLevel}, @@ -94,7 +94,7 @@ pub fn identity_when_valid(_attr: TokenStream, item: TokenStream) -> TokenStream }) .unwrap(); let macro_call_id = res.value.unwrap(); - let macro_file = MacroFile { macro_call_id }; + let macro_file = MacroFileId { macro_call_id }; let mut expansion_result = db.parse_macro_expansion(macro_file); expansion_result.err = expansion_result.err.or(res.err); expansions.push((macro_call.value.clone(), expansion_result)); diff --git a/crates/hir-expand/src/db.rs b/crates/hir-expand/src/db.rs index 393e391f0517..e31034884c5e 100644 --- a/crates/hir-expand/src/db.rs +++ b/crates/hir-expand/src/db.rs @@ -24,7 +24,7 @@ use crate::{ span::{RealSpanMap, SpanMap, SpanMapRef}, tt, AstId, BuiltinAttrExpander, BuiltinDeriveExpander, BuiltinFnLikeExpander, EagerCallInfo, ExpandError, ExpandResult, ExpandTo, ExpansionSpanMap, HirFileId, HirFileIdRepr, MacroCallId, - MacroCallKind, MacroCallLoc, MacroDefId, MacroDefKind, MacroFile, ProcMacroExpander, + MacroCallKind, MacroCallLoc, MacroDefId, MacroDefKind, MacroFileId, ProcMacroExpander, }; /// Total limit on the number of tokens produced by any macro invocation. @@ -102,7 +102,7 @@ pub trait ExpandDatabase: SourceDatabase { // This query is LRU cached fn parse_macro_expansion( &self, - macro_file: MacroFile, + macro_file: MacroFileId, ) -> ExpandResult<(Parse, Arc)>; #[salsa::transparent] fn span_map(&self, file_id: HirFileId) -> SpanMap; @@ -307,7 +307,7 @@ fn parse_or_expand_with_err( fn parse_macro_expansion( db: &dyn ExpandDatabase, - macro_file: MacroFile, + macro_file: MacroFileId, ) -> ExpandResult<(Parse, Arc)> { let _p = profile::span("parse_macro_expansion"); let mbe::ValueResult { value: tt, err } = db.macro_expand(macro_file.macro_call_id); @@ -326,7 +326,7 @@ fn parse_macro_expansion_error( db: &dyn ExpandDatabase, macro_call_id: MacroCallId, ) -> ExpandResult> { - db.parse_macro_expansion(MacroFile { macro_call_id }) + db.parse_macro_expansion(MacroFileId { macro_call_id }) .map(|it| it.0.errors().to_vec().into_boxed_slice()) } diff --git a/crates/hir-expand/src/files.rs b/crates/hir-expand/src/files.rs index 45875d949817..57a7fa5ec398 100644 --- a/crates/hir-expand/src/files.rs +++ b/crates/hir-expand/src/files.rs @@ -1,15 +1,14 @@ use std::iter; use base_db::{ - span::{HirFileId, HirFileIdRepr, MacroFile, SyntaxContextId}, - FileRange, + span::{HirFileId, HirFileIdRepr, MacroFileId, SyntaxContextId}, + FileId, FileRange, }; use either::Either; use syntax::{AstNode, SyntaxNode, SyntaxToken, TextRange}; use crate::{db, ExpansionInfo, HirFileIdExt as _}; -// FIXME: Make an InRealFile wrapper /// `InFile` stores a value of `T` inside a particular file/syntax tree. /// /// Typical usages are: @@ -18,52 +17,88 @@ use crate::{db, ExpansionInfo, HirFileIdExt as _}; /// * `InFile` -- ast node in a file /// * `InFile` -- offset in a file #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] -pub struct InFile { - pub file_id: HirFileId, +pub struct InFileWrapper { + pub file_id: FileKind, pub value: T, } +pub type InFile = InFileWrapper; +pub type InMacroFile = InFileWrapper; +pub type InRealFile = InFileWrapper; -impl InFile { - pub fn new(file_id: HirFileId, value: T) -> InFile { - InFile { file_id, value } +impl InFileWrapper { + pub fn new(file_id: FileKind, value: T) -> Self { + Self { file_id, value } } - pub fn with_value(&self, value: U) -> InFile { - InFile::new(self.file_id, value) + pub fn map U, U>(self, f: F) -> InFileWrapper { + InFileWrapper::new(self.file_id, f(self.value)) + } +} + +impl InFileWrapper { + pub fn with_value(&self, value: U) -> InFileWrapper { + InFileWrapper::new(self.file_id, value) } - pub fn map U, U>(self, f: F) -> InFile { - InFile::new(self.file_id, f(self.value)) - } - - pub fn as_ref(&self) -> InFile<&T> { + pub fn as_ref(&self) -> InFileWrapper { self.with_value(&self.value) } +} +impl InFileWrapper { + pub fn cloned(&self) -> InFileWrapper { + self.with_value(self.value.clone()) + } +} + +impl From> for InFile { + fn from(InMacroFile { file_id, value }: InMacroFile) -> Self { + InFile { file_id: file_id.into(), value } + } +} + +impl From> for InFile { + fn from(InRealFile { file_id, value }: InRealFile) -> Self { + InFile { file_id: file_id.into(), value } + } +} + +// region:transpose impls + +impl InFileWrapper> { + pub fn transpose(self) -> Option> { + Some(InFileWrapper::new(self.file_id, self.value?)) + } +} + +impl InFileWrapper> { + pub fn transpose(self) -> Either, InFileWrapper> { + match self.value { + Either::Left(l) => Either::Left(InFileWrapper::new(self.file_id, l)), + Either::Right(r) => Either::Right(InFileWrapper::new(self.file_id, r)), + } + } +} + +// endregion:transpose impls + +// region:specific impls + +impl InFile { pub fn file_syntax(&self, db: &dyn db::ExpandDatabase) -> SyntaxNode { db.parse_or_expand(self.file_id) } } -impl InFile<&T> { - pub fn cloned(&self) -> InFile { - self.with_value(self.value.clone()) +impl InRealFile { + pub fn file_syntax(&self, db: &dyn db::ExpandDatabase) -> SyntaxNode { + db.parse(self.file_id).syntax_node() } } -impl InFile> { - pub fn transpose(self) -> Option> { - let value = self.value?; - Some(InFile::new(self.file_id, value)) - } -} - -impl InFile> { - pub fn transpose(self) -> Either, InFile> { - match self.value { - Either::Left(l) => Either::Left(InFile::new(self.file_id, l)), - Either::Right(r) => Either::Right(InFile::new(self.file_id, r)), - } +impl InMacroFile { + pub fn file_syntax(&self, db: &dyn db::ExpandDatabase) -> SyntaxNode { + db.parse_macro_expansion(self.file_id).value.0.syntax_node() } } @@ -159,11 +194,17 @@ impl InFile<&SyntaxNode> { } } - pub fn original_syntax_node(self, db: &dyn db::ExpandDatabase) -> Option> { + pub fn original_syntax_node( + self, + db: &dyn db::ExpandDatabase, + ) -> Option> { // This kind of upmapping can only be achieved in attribute expanded files, // as we don't have node inputs otherwise and therefore can't find an `N` node in the input - let Some(file_id) = self.file_id.macro_file() else { - return Some(self.map(Clone::clone)); + let file_id = match self.file_id.repr() { + HirFileIdRepr::FileId(file_id) => { + return Some(InRealFile { file_id, value: self.value.clone() }) + } + HirFileIdRepr::MacroFile(m) => m, }; if !self.file_id.is_attr_macro(db) { return None; @@ -182,7 +223,7 @@ impl InFile<&SyntaxNode> { let kind = self.value.kind(); // FIXME: This heuristic is brittle and with the right macro may select completely unrelated nodes? let value = anc.ancestors().find(|it| it.kind() == kind)?; - Some(InFile::new(file_id.into(), value)) + Some(InRealFile::new(file_id, value)) } } @@ -230,29 +271,11 @@ impl InFile { } } -#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] -pub struct InMacroFile { - pub file_id: MacroFile, - pub value: T, -} - -impl From> for InFile { - fn from(macro_file: InMacroFile) -> Self { - InFile { file_id: macro_file.file_id.into(), value: macro_file.value } - } -} - -pub fn ascend_range_up_macros( - db: &dyn db::ExpandDatabase, - range: InFile, -) -> (FileRange, SyntaxContextId) { - match range.file_id.repr() { - HirFileIdRepr::FileId(file_id) => { - (FileRange { file_id, range: range.value }, SyntaxContextId::ROOT) - } - HirFileIdRepr::MacroFile(m) => { - ExpansionInfo::new(db, m).map_token_range_up(db, range.value) - } +impl InFile { + /// Attempts to map the syntax node back up its macro calls. + pub fn original_file_range(self, db: &dyn db::ExpandDatabase) -> FileRange { + let (range, _ctxt) = ascend_range_up_macros(db, self); + range } } @@ -261,12 +284,14 @@ impl InFile { self.value.syntax().descendants().filter_map(T::cast).map(move |n| self.with_value(n)) } - // FIXME: this should return `Option>` - pub fn original_ast_node(self, db: &dyn db::ExpandDatabase) -> Option> { + pub fn original_ast_node(self, db: &dyn db::ExpandDatabase) -> Option> { // This kind of upmapping can only be achieved in attribute expanded files, // as we don't have node inputs otherwise and therefore can't find an `N` node in the input - let Some(file_id) = self.file_id.macro_file() else { - return Some(self); + let file_id = match self.file_id.repr() { + HirFileIdRepr::FileId(file_id) => { + return Some(InRealFile { file_id, value: self.value }) + } + HirFileIdRepr::MacroFile(m) => m, }; if !self.file_id.is_attr_macro(db) { return None; @@ -284,10 +309,24 @@ impl InFile { // FIXME: This heuristic is brittle and with the right macro may select completely unrelated nodes? let anc = db.parse(file_id).syntax_node().covering_element(range); let value = anc.ancestors().find_map(N::cast)?; - return Some(InFile::new(file_id.into(), value)); + Some(InRealFile::new(file_id, value)) } pub fn syntax(&self) -> InFile<&SyntaxNode> { self.with_value(self.value.syntax()) } } + +fn ascend_range_up_macros( + db: &dyn db::ExpandDatabase, + range: InFile, +) -> (FileRange, SyntaxContextId) { + match range.file_id.repr() { + HirFileIdRepr::FileId(file_id) => { + (FileRange { file_id, range: range.value }, SyntaxContextId::ROOT) + } + HirFileIdRepr::MacroFile(m) => { + ExpansionInfo::new(db, m).map_token_range_up(db, range.value) + } + } +} diff --git a/crates/hir-expand/src/lib.rs b/crates/hir-expand/src/lib.rs index d2e5e7c3643f..13eb90b18a8e 100644 --- a/crates/hir-expand/src/lib.rs +++ b/crates/hir-expand/src/lib.rs @@ -48,9 +48,9 @@ use crate::{ }; pub use crate::ast_id_map::{AstId, ErasedAstId, ErasedFileAstId}; -pub use crate::files::{InFile, InMacroFile}; +pub use crate::files::{InFile, InMacroFile, InRealFile}; -pub use base_db::span::{HirFileId, MacroCallId, MacroFile}; +pub use base_db::span::{HirFileId, MacroCallId, MacroFileId}; pub use mbe::ValueResult; pub type DeclarativeMacro = ::mbe::DeclarativeMacro; @@ -206,7 +206,7 @@ impl HirFileIdExt for HirFileId { loop { match file_id.repr() { HirFileIdRepr::FileId(id) => break id, - HirFileIdRepr::MacroFile(MacroFile { macro_call_id }) => { + HirFileIdRepr::MacroFile(MacroFileId { macro_call_id }) => { let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_call_id); let is_include_expansion = loc.def.is_include() && loc.eager.is_some(); file_id = match is_include_expansion.then(|| db.include_expand(macro_call_id)) { @@ -241,7 +241,7 @@ impl HirFileIdExt for HirFileId { loop { match call.file_id.repr() { HirFileIdRepr::FileId(file_id) => break Some((file_id, call.value)), - HirFileIdRepr::MacroFile(MacroFile { macro_call_id }) => { + HirFileIdRepr::MacroFile(MacroFileId { macro_call_id }) => { call = db.lookup_intern_macro_call(macro_call_id).to_node(db); } } @@ -700,7 +700,7 @@ impl ExpansionInfo { } } - pub fn new(db: &dyn db::ExpandDatabase, macro_file: MacroFile) -> ExpansionInfo { + pub fn new(db: &dyn db::ExpandDatabase, macro_file: MacroFileId) -> ExpansionInfo { let loc: MacroCallLoc = db.lookup_intern_macro_call(macro_file.macro_call_id); let arg_tt = loc.kind.arg(db); diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 443c19af82d3..aacc3b08cb79 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -59,7 +59,7 @@ use hir_def::{ Lookup, MacroExpander, MacroId, ModuleId, StaticId, StructId, TraitAliasId, TraitId, TypeAliasId, TypeOrConstParamId, TypeParamId, UnionId, }; -use hir_expand::{name::name, InMacroFile, MacroCallKind}; +use hir_expand::{name::name, MacroCallKind}; use hir_ty::{ all_super_traits, autoderef, check_orphan_rules, consteval::{try_const_usize, unknown_const_as_generic, ConstEvalError, ConstExt}, @@ -124,7 +124,7 @@ pub use { hir_expand::{ attrs::{Attr, AttrId}, name::{known, Name}, - tt, ExpandResult, HirFileId, HirFileIdExt, InFile, MacroFile, + tt, ExpandResult, HirFileId, HirFileIdExt, InFile, InMacroFile, InRealFile, MacroFileId, }, hir_ty::{ display::{ClosureStyle, HirDisplay, HirDisplayError, HirWrite}, @@ -3505,7 +3505,7 @@ impl Impl { } _ => return None, }; - let file_id = MacroFile { macro_call_id: derive_attr }; + let file_id = MacroFileId { macro_call_id: derive_attr }; let path = db .parse_macro_expansion(file_id) .value diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 137cffa7af15..e124e14a5422 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -15,7 +15,9 @@ use hir_def::{ type_ref::Mutability, AsMacroCall, DefWithBodyId, FieldId, FunctionId, MacroId, TraitId, VariantId, }; -use hir_expand::{db::ExpandDatabase, name::AsName, ExpansionInfo, HirFileIdExt, MacroCallId}; +use hir_expand::{ + db::ExpandDatabase, files::InRealFile, name::AsName, ExpansionInfo, HirFileIdExt, MacroCallId, +}; use itertools::Itertools; use rustc_hash::{FxHashMap, FxHashSet}; use smallvec::{smallvec, SmallVec}; @@ -756,8 +758,8 @@ impl<'db> SemanticsImpl<'db> { /// This only work for attribute expansions, as other ones do not have nodes as input. pub fn original_ast_node(&self, node: N) -> Option { self.wrap_node_infile(node).original_ast_node(self.db.upcast()).map( - |InFile { file_id, value }| { - self.cache(find_root(value.syntax()), file_id); + |InRealFile { file_id, value }| { + self.cache(find_root(value.syntax()), file_id.into()); value }, ) @@ -768,8 +770,8 @@ impl<'db> SemanticsImpl<'db> { pub fn original_syntax_node(&self, node: &SyntaxNode) -> Option { let InFile { file_id, .. } = self.find_file(node); InFile::new(file_id, node).original_syntax_node(self.db.upcast()).map( - |InFile { file_id, value }| { - self.cache(find_root(&value), file_id); + |InRealFile { file_id, value }| { + self.cache(find_root(&value), file_id.into()); value }, ) diff --git a/crates/hir/src/symbols.rs b/crates/hir/src/symbols.rs index 6ea926cc22d8..a392070fd88e 100644 --- a/crates/hir/src/symbols.rs +++ b/crates/hir/src/symbols.rs @@ -7,7 +7,7 @@ use hir_def::{ AdtId, AssocItemId, DefWithBodyId, HasModule, ImplId, Lookup, MacroId, ModuleDefId, ModuleId, TraitId, }; -use hir_expand::{files::ascend_range_up_macros, HirFileId, InFile}; +use hir_expand::{HirFileId, InFile}; use hir_ty::db::HirDatabase; use syntax::{ast::HasName, AstNode, SmolStr, SyntaxNode, SyntaxNodePtr}; @@ -51,8 +51,7 @@ impl DeclarationLocation { } pub fn original_name_range(&self, db: &dyn HirDatabase) -> FileRange { - let mapping = InFile::new(self.hir_file_id, self.name_ptr.text_range()); - ascend_range_up_macros(db.upcast(), mapping).0 + InFile::new(self.hir_file_id, self.name_ptr.text_range()).original_file_range(db.upcast()) } } diff --git a/crates/ide-assists/src/handlers/generate_enum_variant.rs b/crates/ide-assists/src/handlers/generate_enum_variant.rs index be7a5e6c8bcc..1a1e992e28a4 100644 --- a/crates/ide-assists/src/handlers/generate_enum_variant.rs +++ b/crates/ide-assists/src/handlers/generate_enum_variant.rs @@ -1,4 +1,4 @@ -use hir::{HasSource, HirDisplay, HirFileIdExt, InFile}; +use hir::{HasSource, HirDisplay, InRealFile}; use ide_db::assists::{AssistId, AssistKind}; use syntax::{ ast::{self, make, HasArgList}, @@ -114,14 +114,14 @@ fn add_variant_to_accumulator( parent: PathParent, ) -> Option<()> { let db = ctx.db(); - let InFile { file_id, value: enum_node } = adt.source(db)?.original_ast_node(db)?; + let InRealFile { file_id, value: enum_node } = adt.source(db)?.original_ast_node(db)?; acc.add( AssistId("generate_enum_variant", AssistKind::Generate), "Generate variant", target, |builder| { - builder.edit_file(file_id.original_file(db)); + builder.edit_file(file_id); let node = builder.make_mut(enum_node); let variant = make_variant(ctx, name_ref, parent); node.variant_list().map(|it| it.add_variant(variant.clone_for_update())); diff --git a/crates/ide-db/src/rename.rs b/crates/ide-db/src/rename.rs index 9f101468a350..676d286b8dcc 100644 --- a/crates/ide-db/src/rename.rs +++ b/crates/ide-db/src/rename.rs @@ -533,7 +533,7 @@ fn source_edit_from_def( } }, }; - file_id = source.file_id.file_id(); + file_id = Some(source.file_id); if let Either::Left(pat) = source.value { let name_range = pat.name().unwrap().syntax().text_range(); // special cases required for renaming fields/locals in Record patterns diff --git a/crates/ide/src/annotations.rs b/crates/ide/src/annotations.rs index fb79b5dc211a..d7f82b4af3e1 100644 --- a/crates/ide/src/annotations.rs +++ b/crates/ide/src/annotations.rs @@ -1,4 +1,4 @@ -use hir::{HasSource, InFile, Semantics}; +use hir::{HasSource, InFile, InRealFile, Semantics}; use ide_db::{ base_db::{FileId, FilePosition, FileRange}, defs::Definition, @@ -149,8 +149,8 @@ pub(crate) fn annotations( node: InFile, source_file_id: FileId, ) -> Option<(TextRange, Option)> { - if let Some(InFile { file_id, value }) = node.original_ast_node(db) { - if file_id == source_file_id.into() { + if let Some(InRealFile { file_id, value }) = node.original_ast_node(db) { + if file_id == source_file_id { return Some(( value.syntax().text_range(), value.name().map(|name| name.syntax().text_range()), diff --git a/crates/ide/src/status.rs b/crates/ide/src/status.rs index c9ee460a1c26..e7f97ebe6f7b 100644 --- a/crates/ide/src/status.rs +++ b/crates/ide/src/status.rs @@ -2,7 +2,7 @@ use std::{fmt, marker::PhantomData}; use hir::{ db::{AstIdMapQuery, AttrsQuery, BlockDefMapQuery, ParseMacroExpansionQuery}, - Attr, Attrs, ExpandResult, MacroFile, Module, + Attr, Attrs, ExpandResult, MacroFileId, Module, }; use ide_db::{ base_db::{ @@ -199,8 +199,12 @@ impl StatCollect> for SyntaxTreeStats { } } -impl StatCollect, M)>> for SyntaxTreeStats { - fn collect_entry(&mut self, _: MacroFile, value: Option, M)>>) { +impl StatCollect, M)>> for SyntaxTreeStats { + fn collect_entry( + &mut self, + _: MacroFileId, + value: Option, M)>>, + ) { self.total += 1; self.retained += value.is_some() as usize; } diff --git a/crates/proc-macro-api/src/msg/flat.rs b/crates/proc-macro-api/src/msg/flat.rs index 22d9f3952cc2..f29aac529568 100644 --- a/crates/proc-macro-api/src/msg/flat.rs +++ b/crates/proc-macro-api/src/msg/flat.rs @@ -88,7 +88,7 @@ pub struct FlatTree { } #[derive(Serialize, Deserialize, Debug)] -pub struct SpanMap { +struct SpanMap { #[serde(skip_serializing)] serialize: bool, span_size: u32, @@ -122,7 +122,7 @@ impl SpanMap { } impl SpanMap { - pub fn do_serialize(&self) -> bool { + fn do_serialize(&self) -> bool { self.serialize } }