Skip to content

Commit

Permalink
refactor(edit): Remove unused raw field on Document
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Mar 11, 2024
1 parent 8b6f77e commit fcf1deb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
4 changes: 2 additions & 2 deletions crates/toml_edit/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ impl<S: AsRef<str>> Deserializer<S> {

impl From<crate::Document> for Deserializer {
fn from(doc: crate::Document) -> Self {
let crate::Document { root, raw, .. } = doc;
Self { root, raw }
let crate::Document { root, .. } = doc;
Self { root, raw: None }
}
}

Expand Down
5 changes: 0 additions & 5 deletions crates/toml_edit/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ impl<S: AsRef<str>> ImDocument<S> {
Document {
root: self.root,
trailing: self.trailing,
// prevent a child of `ImDocument` from being inserted into `Document` and having the
// spans evaluated when using `crate::encode`
raw: None,
}
}
}
Expand Down Expand Up @@ -114,7 +111,6 @@ pub struct Document {
pub(crate) root: Item,
// Trailing comments and whitespaces
pub(crate) trailing: RawString,
pub(crate) raw: Option<String>,
}

impl Document {
Expand Down Expand Up @@ -166,7 +162,6 @@ impl Default for Document {
Self {
root: Item::Table(Table::with_pos(Some(0))),
trailing: Default::default(),
raw: Default::default(),
}
}
}
Expand Down
12 changes: 2 additions & 10 deletions crates/toml_edit/src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,9 @@ impl Display for Document {
tables.sort_by_key(|&(id, _, _, _)| id);
let mut first_table = true;
for (_, table, path, is_array) in tables {
visit_table(
f,
self.raw.as_deref(),
table,
&path,
is_array,
&mut first_table,
)?;
visit_table(f, None, table, &path, is_array, &mut first_table)?;
}
self.trailing()
.encode_with_default(f, self.raw.as_deref(), "")
self.trailing().encode_with_default(f, None, "")
}
}

Expand Down

0 comments on commit fcf1deb

Please sign in to comment.