diff --git a/crates/toml_edit/src/inline_table.rs b/crates/toml_edit/src/inline_table.rs index 0e125522..316637d2 100644 --- a/crates/toml_edit/src/inline_table.rs +++ b/crates/toml_edit/src/inline_table.rs @@ -186,7 +186,7 @@ impl InlineTable { } /// Returns an accessor to a key's formatting - pub fn key(&mut self, key: &str) -> Option<&'_ Key> { + pub fn key(&self, key: &str) -> Option<&'_ Key> { self.items.get(key).map(|kv| &kv.key) } @@ -578,7 +578,7 @@ impl TableLike for InlineTable { self.is_dotted() } - fn key(&mut self, key: &str) -> Option<&'_ Key> { + fn key(&self, key: &str) -> Option<&'_ Key> { self.key(key) } fn key_mut(&mut self, key: &str) -> Option> { diff --git a/crates/toml_edit/src/table.rs b/crates/toml_edit/src/table.rs index 72a53343..cc0d2b2d 100644 --- a/crates/toml_edit/src/table.rs +++ b/crates/toml_edit/src/table.rs @@ -219,7 +219,7 @@ impl Table { } /// Returns an accessor to a key's formatting - pub fn key(&mut self, key: &str) -> Option<&'_ Key> { + pub fn key(&self, key: &str) -> Option<&'_ Key> { self.items.get(key).map(|kv| &kv.key) } @@ -577,7 +577,7 @@ pub trait TableLike: crate::private::Sealed { fn is_dotted(&self) -> bool; /// Returns an accessor to a key's formatting - fn key(&mut self, key: &str) -> Option<&'_ Key>; + fn key(&self, key: &str) -> Option<&'_ Key>; /// Returns an accessor to a key's formatting fn key_mut(&mut self, key: &str) -> Option>; /// Returns the decor associated with a given key of the table. @@ -642,7 +642,7 @@ impl TableLike for Table { self.set_dotted(yes) } - fn key(&mut self, key: &str) -> Option<&'_ Key> { + fn key(&self, key: &str) -> Option<&'_ Key> { self.key(key) } fn key_mut(&mut self, key: &str) -> Option> {