Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ release = false
[features]
default = []
simd = ["toml_parse/simd"]
unsafe = ["toml_parse/unsafe", "toml_edit/unsafe"]
unsafe = ["toml_parse/unsafe"]
preserve_order = ["toml_old/preserve_order", "toml/preserve_order"]
fast_hash = ["toml/fast_hash"]

Expand Down
1 change: 0 additions & 1 deletion crates/toml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ std = ["indexmap?/std"]
serde = ["dep:serde", "toml_datetime/serde", "serde_spanned/serde"]
parse = ["dep:toml_parse", "dep:winnow"]
display = ["dep:toml_write"]
unsafe = ["toml_parse?/unsafe"]
fast_hash = ["preserve_order", "dep:foldhash"]
debug = ["std", "toml_parse?/debug", "dep:anstream", "dep:anstyle"]

Expand Down
3 changes: 0 additions & 3 deletions crates/toml/src/de/parser/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ impl State {
let key_span = key.span();
let key_span = key_span.start()..key_span.end();

#[cfg(feature = "unsafe")] // SAFETY: lexing and parsing all with same source
let raw = unsafe { source.get_unchecked(key) };
#[cfg(not(feature = "unsafe"))]
let raw = source.get(key).unwrap();
let mut decoded = alloc::borrow::Cow::Borrowed("");
raw.decode_key(&mut decoded, errors);
Expand Down
3 changes: 0 additions & 3 deletions crates/toml/src/de/parser/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ pub(crate) fn on_scalar<'i>(
let value_span = event.span();
let value_span = value_span.start()..value_span.end();

#[cfg(feature = "unsafe")] // SAFETY: lexing and parsing all with same source
let raw = unsafe { source.get_unchecked(event) };
#[cfg(not(feature = "unsafe"))]
let raw = source.get(event).unwrap();
let mut decoded = alloc::borrow::Cow::Borrowed("");
let kind = raw.decode_scalar(&mut decoded, errors);
Expand Down
2 changes: 1 addition & 1 deletion crates/toml/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
// Presence of this annotation is picked up by tools such as cargo-geiger
// and lets them ensure that there is indeed no unsafe code as opposed to
// something they couldn't detect (e.g. unsafe added via macro expansion, etc).
#![cfg_attr(not(feature = "unsafe"), forbid(unsafe_code))]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(clippy::print_stderr)]
#![warn(clippy::print_stdout)]
Expand Down
3 changes: 0 additions & 3 deletions crates/toml_edit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ pre-release-replacements = [
default = ["parse", "display"]
parse = ["dep:toml_parse", "dep:winnow"]
display = ["dep:toml_write"]
unsafe = ["toml_parse?/unsafe"]
perf = ["dep:kstring", "toml_parse?/simd"]
serde = ["dep:serde", "toml_datetime/serde", "dep:serde_spanned"]
debug = ["toml_parse?/debug", "dep:anstream", "dep:anstyle", "display"]
# Provide a method disable_recursion_limit to parse arbitrarily deep structures
Expand All @@ -44,7 +42,6 @@ unbounded = []
indexmap = { version = "2.3.0", features = ["std"] }
winnow = { version = "0.7.10", optional = true }
serde = { version = "1.0.145", optional = true }
kstring = { version = "2.0.0", features = ["max_inline"], optional = true }
toml_datetime = { version = "0.6.11", path = "../toml_datetime" }
serde_spanned = { version = "0.6.9", path = "../serde_spanned", features = ["serde"], optional = true }
toml_write = { version = "0.1.2", path = "../toml_write", optional = true }
Expand Down
14 changes: 7 additions & 7 deletions crates/toml_edit/src/inline_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::iter::FromIterator;
use crate::key::Key;
use crate::repr::Decor;
use crate::table::{Iter, IterMut, KeyValuePairs, TableLike};
use crate::{InternalString, Item, KeyMut, RawString, Table, Value};
use crate::{Item, KeyMut, RawString, Table, Value};

/// A TOML [`Value`] that contains a collection of [`Key`]/[`Value`] pairs
#[derive(Debug, Default, Clone)]
Expand Down Expand Up @@ -276,7 +276,7 @@ impl InlineTable {
}

/// Gets the given key's corresponding entry in the Table for in-place manipulation.
pub fn entry(&'_ mut self, key: impl Into<InternalString>) -> InlineEntry<'_> {
pub fn entry(&'_ mut self, key: impl Into<String>) -> InlineEntry<'_> {
match self.items.entry(key.into().into()) {
indexmap::map::Entry::Occupied(mut entry) => {
// Ensure it is a `Value` to simplify `InlineOccupiedEntry`'s code.
Expand Down Expand Up @@ -365,7 +365,7 @@ impl InlineTable {
/// Returns a mutable reference to the corresponding value.
pub fn get_or_insert<V: Into<Value>>(
&mut self,
key: impl Into<InternalString>,
key: impl Into<String>,
value: V,
) -> &mut Value {
let key = key.into();
Expand All @@ -377,7 +377,7 @@ impl InlineTable {
}

/// Inserts a key-value pair into the map.
pub fn insert(&mut self, key: impl Into<InternalString>, value: Value) -> Option<Value> {
pub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value> {
use indexmap::map::MutableEntryKey;
let key = Key::new(key);
let value = Item::Value(value);
Expand Down Expand Up @@ -472,7 +472,7 @@ impl<K: Into<Key>, V: Into<Value>> FromIterator<(K, V)> for InlineTable {
}

impl IntoIterator for InlineTable {
type Item = (InternalString, Value);
type Item = (String, Value);
type IntoIter = InlineTableIntoIter;

fn into_iter(self) -> Self::IntoIter {
Expand Down Expand Up @@ -509,7 +509,7 @@ fn decorate_inline_table(table: &mut InlineTable) {
}

/// An owned iterator type over an [`InlineTable`]'s [`Key`]/[`Value`] pairs
pub type InlineTableIntoIter = Box<dyn Iterator<Item = (InternalString, Value)>>;
pub type InlineTableIntoIter = Box<dyn Iterator<Item = (String, Value)>>;
/// An iterator type over [`InlineTable`]'s [`Key`]/[`Value`] pairs
pub type InlineTableIter<'a> = Box<dyn Iterator<Item = (&'a str, &'a Value)> + 'a>;
/// A mutable iterator type over [`InlineTable`]'s [`Key`]/[`Value`] pairs
Expand All @@ -531,7 +531,7 @@ impl TableLike for InlineTable {
self.clear();
}
fn entry<'a>(&'a mut self, key: &str) -> crate::Entry<'a> {
// Accept a `&str` rather than an owned type to keep `InternalString`, well, internal
// Accept a `&str` rather than an owned type to keep `String`, well, internal
match self.items.entry(key.into()) {
indexmap::map::Entry::Occupied(entry) => {
crate::Entry::Occupied(crate::OccupiedEntry { entry })
Expand Down
193 changes: 0 additions & 193 deletions crates/toml_edit/src/internal_string.rs

This file was deleted.

13 changes: 3 additions & 10 deletions crates/toml_edit/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::str::FromStr;
use toml_write::ToTomlKey as _;

use crate::repr::{Decor, Repr};
use crate::InternalString;

/// For Key/[`Value`][crate::Value] pairs under a [`Table`][crate::Table] header or inside an
/// [`InlineTable`][crate::InlineTable]
Expand All @@ -32,15 +31,15 @@ use crate::InternalString;
/// To parse a key use `FromStr` trait implementation: `"string".parse::<Key>()`.
#[derive(Debug)]
pub struct Key {
key: InternalString,
key: String,
pub(crate) repr: Option<Repr>,
pub(crate) leaf_decor: Decor,
pub(crate) dotted_decor: Decor,
}

impl Key {
/// Create a new table key
pub fn new(key: impl Into<InternalString>) -> Self {
pub fn new(key: impl Into<String>) -> Self {
Self {
key: key.into(),
repr: None,
Expand Down Expand Up @@ -292,14 +291,8 @@ impl From<String> for Key {
}
}

impl From<InternalString> for Key {
fn from(s: InternalString) -> Self {
Self::new(s)
}
}

#[doc(hidden)]
impl From<Key> for InternalString {
impl From<Key> for String {
fn from(key: Key) -> Self {
key.key
}
Expand Down
Loading
Loading