Skip to content

Commit

Permalink
feat: bump toml crate to 0.7
Browse files Browse the repository at this point in the history
close #386
  • Loading branch information
JounQin committed Jan 28, 2024
1 parent bb50e78 commit 719e185
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 32 deletions.
87 changes: 76 additions & 11 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/taplo-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ taplo = { version = "0.13.0", path = "../taplo", features = ["serde"] }
taplo-common = { version = "0.5.0", path = "../taplo-common" }
taplo-lsp = { version = "0.7.0", path = "../taplo-lsp", default-features = false, optional = true }
time = { version = "0.3", features = ["parsing"] }
toml = "0.5"
toml = "0.7"
tracing = "0.1.29"
tracing-subscriber = { version = "0.3.7", features = ["env-filter"] }
url = "2.2.2"
Expand Down
3 changes: 2 additions & 1 deletion crates/taplo-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use args::GeneralArgs;
use itertools::Itertools;
use std::{
path::{Path, PathBuf},
str,
sync::Arc,
};
use taplo_common::{config::Config, environment::Environment, schema::Schemas, util::Normalize};
Expand Down Expand Up @@ -53,7 +54,7 @@ impl<E: Environment> Taplo<E> {
if let Some(c) = config_path {
tracing::info!(path = ?c, "found configuration file");
match self.env.read_file(&c).await {
Ok(cfg) => match toml::from_slice(&cfg) {
Ok(cfg) => match toml::from_str(str::from_utf8(&cfg)?) {
Ok(c) => config = c,
Err(error) => {
tracing::warn!(%error, "invalid configuration file");
Expand Down
2 changes: 1 addition & 1 deletion crates/taplo-lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tap = "1.0.1"
taplo = { version = "0.13.0", path = "../taplo", features = ["serde"] }
taplo-common = { version = "0.5.0", path = "../taplo-common" }
time = { version = "0.3", features = ["formatting", "parsing"] }
toml = "0.5"
toml = "0.7"
tracing = "0.1.29"

[package.metadata.auto-tag]
Expand Down
4 changes: 2 additions & 2 deletions crates/taplo-lsp/src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use lsp_types::Url;
use once_cell::sync::Lazy;
use regex::Regex;
use serde_json::json;
use std::{sync::Arc, time::Duration};
use std::{str, sync::Arc, time::Duration};
use taplo::{dom::Node, parser::Parse};
use taplo_common::{
config::Config,
Expand Down Expand Up @@ -247,7 +247,7 @@ impl<E: Environment> WorkspaceState<E> {

if let Some(config_path) = config_path {
tracing::info!(path = ?config_path, "using config file");
self.taplo_config = toml::from_slice(&env.read_file(&config_path).await?)?;
self.taplo_config = toml::from_str(str::from_utf8(&env.read_file(&config_path).await?)?)?;
}
}

Expand Down
Loading

0 comments on commit 719e185

Please sign in to comment.