From 9e4cf2397b60ee5b9fc551847f39800b105ec68a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Wed, 6 Apr 2022 18:08:54 +0200 Subject: [PATCH] satisfy clippy and rustfmt --- ci/lib.rs | 5 ++++- ci/tests/toml.rs | 2 +- src/config.rs | 2 +- src/cross_toml.rs | 8 ++++---- src/lib.rs | 2 +- src/main.rs | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ci/lib.rs b/ci/lib.rs index 6e5413632..e571fadfc 100644 --- a/ci/lib.rs +++ b/ci/lib.rs @@ -1,4 +1,7 @@ -use std::{path::{Path, PathBuf}, ffi::OsStr}; +use std::{ + ffi::OsStr, + path::{Path, PathBuf}, +}; use once_cell::sync::OnceCell; use serde::Deserialize; diff --git a/ci/tests/toml.rs b/ci/tests/toml.rs index 26adf73bd..b5243afa1 100644 --- a/ci/tests/toml.rs +++ b/ci/tests/toml.rs @@ -41,7 +41,7 @@ fn toml_check() -> Result<(), Box> { dir_entry.path().display(), text_line_no(&contents, fence.range().start), ); - assert!(cross::cross_toml::CrossToml::from_str(fence.as_str())? + assert!(cross::cross_toml::CrossToml::parse(fence.as_str())? .1 .is_empty()); } diff --git a/src/config.rs b/src/config.rs index b6749d868..d12f94a48 100644 --- a/src/config.rs +++ b/src/config.rs @@ -319,7 +319,7 @@ mod tests { use std::matches; fn toml(content: &str) -> Result { - Ok(CrossToml::from_str(content) + Ok(CrossToml::parse(content) .wrap_err("couldn't parse toml")? .0) } diff --git a/src/cross_toml.rs b/src/cross_toml.rs index 8b8ca347e..2c33d384d 100644 --- a/src/cross_toml.rs +++ b/src/cross_toml.rs @@ -45,7 +45,7 @@ pub struct CrossToml { impl CrossToml { /// Parses the [`CrossToml`] from a string - pub fn from_str(toml_str: &str) -> Result<(Self, BTreeSet)> { + pub fn parse(toml_str: &str) -> Result<(Self, BTreeSet)> { let tomld = &mut toml::Deserializer::new(toml_str); let mut unused = BTreeSet::new(); @@ -128,7 +128,7 @@ mod tests { targets: HashMap::new(), build: CrossBuildConfig::default(), }; - let (parsed_cfg, _) = CrossToml::from_str("")?; + let (parsed_cfg, _) = CrossToml::parse("")?; assert_eq!(parsed_cfg, cfg); @@ -157,7 +157,7 @@ mod tests { volumes = ["VOL1_ARG", "VOL2_ARG"] passthrough = ["VAR1", "VAR2"] "#; - let (parsed_cfg, _) = CrossToml::from_str(test_str)?; + let (parsed_cfg, _) = CrossToml::parse(test_str)?; assert_eq!(parsed_cfg, cfg); @@ -195,7 +195,7 @@ mod tests { xargo = false image = "test-image" "#; - let (parsed_cfg, _) = CrossToml::from_str(test_str)?; + let (parsed_cfg, _) = CrossToml::parse(test_str)?; assert_eq!(parsed_cfg, cfg); diff --git a/src/lib.rs b/src/lib.rs index e9d1425ef..9c0acce15 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -405,7 +405,7 @@ fn toml(root: &Root) -> Result> { let content = file::read(&path) .wrap_err_with(|| format!("could not read file `{}`", path.display()))?; - let (config, _) = CrossToml::from_str(&content) + let (config, _) = CrossToml::parse(&content) .wrap_err_with(|| format!("failed to parse file `{}` as TOML", path.display()))?; Ok(Some(config)) diff --git a/src/main.rs b/src/main.rs index b7236dea0..cd05c1e89 100644 --- a/src/main.rs +++ b/src/main.rs @@ -170,7 +170,7 @@ fn toml(root: &Root) -> Result> { let content = cross::file::read(&path) .wrap_err_with(|| format!("could not read file `{}`", path.display()))?; - let (config, _) = CrossToml::from_str(&content) + let (config, _) = CrossToml::parse(&content) .wrap_err_with(|| format!("failed to parse file `{}` as TOML", path.display()))?; Ok(Some(config))