Skip to content

Commit

Permalink
satisfy clippy and rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis committed Apr 6, 2022
1 parent 778af2d commit 2e55b1c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
5 changes: 4 additions & 1 deletion ci/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ci/tests/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn toml_check() -> Result<(), Box<dyn std::error::Error>> {
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());
}
Expand Down
4 changes: 1 addition & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,7 @@ mod tests {
use std::matches;

fn toml(content: &str) -> Result<crate::CrossToml> {
Ok(CrossToml::from_str(content)
.wrap_err("couldn't parse toml")?
.0)
Ok(CrossToml::parse(content).wrap_err("couldn't parse toml")?.0)
}

#[test]
Expand Down
8 changes: 4 additions & 4 deletions src/cross_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>)> {
pub fn parse(toml_str: &str) -> Result<(Self, BTreeSet<String>)> {
let tomld = &mut toml::Deserializer::new(toml_str);

let mut unused = BTreeSet::new();
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ fn toml(root: &Root) -> Result<Option<CrossToml>> {
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))
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn toml(root: &Root) -> Result<Option<CrossToml>> {
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))
Expand Down

0 comments on commit 2e55b1c

Please sign in to comment.