summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2023-03-01 00:14:47 -0500
committerGitHub <noreply@github.com>2023-03-01 00:14:47 -0500
commite8ae1a265ad52c0ff28dc9edf8dcfe7bc0ed669d (patch)
tree58252ff49fbc97a302d0e2b6e6fb5968e48b2ce6 /src
parentf02bd21948913966c6c8f78c3f51938aa9e045c8 (diff)
other: switch to toml_edit (#1034)
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs2
-rw-r--r--src/options.rs4
-rw-r--r--src/utils/error.rs4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 4129ce23..4fcb57da 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -241,7 +241,7 @@ pub fn create_or_get_config(config_path: &Option<PathBuf>) -> error::Result<Conf
if let Some(path) = config_path {
if let Ok(config_string) = fs::read_to_string(path) {
// We found a config file!
- Ok(toml::from_str(config_string.as_str())?)
+ Ok(toml_edit::de::from_str(config_string.as_str())?)
} else {
// Config file DNE...
if let Some(parent_path) = path.parent() {
diff --git a/src/options.rs b/src/options.rs
index 6e4f089d..1c001e44 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -115,7 +115,7 @@ pub struct ConfigColours {
impl ConfigColours {
/// Returns `true` if there is a [`ConfigColours`] that is empty or there isn't one at all.
pub fn is_empty(&self) -> bool {
- if let Ok(serialized_string) = toml::to_string(self) {
+ if let Ok(serialized_string) = toml_edit::ser::to_string(self) {
return serialized_string.is_empty();
}
@@ -442,7 +442,7 @@ pub fn get_widget_layout(
Some(r) => r,
None => {
// This cannot (like it really shouldn't) fail!
- ref_row = toml::from_str::<Config>(if get_use_battery(matches, config) {
+ ref_row = toml_edit::de::from_str::<Config>(if get_use_battery(matches, config) {
DEFAULT_BATTERY_LAYOUT
} else {
DEFAULT_LAYOUT
diff --git a/src/utils/error.rs b/src/utils/error.rs
index 1473a9ae..5b95e19a 100644
--- a/src/utils/error.rs
+++ b/src/utils/error.rs
@@ -69,8 +69,8 @@ impl From<std::string::String> for BottomError {
}
}
-impl From<toml::de::Error> for BottomError {
- fn from(err: toml::de::Error) -> Self {
+impl From<toml_edit::de::Error> for BottomError {
+ fn from(err: toml_edit::de::Error) -> Self {
BottomError::ConfigError(err.to_string())
}
}