Skip to content

Commit

Permalink
Merge pull request #471 from matthiasbeyer/clippy-exact-toolchains
Browse files Browse the repository at this point in the history
Clippy exact toolchains
  • Loading branch information
matthiasbeyer authored Oct 6, 2023
2 parents d7c1656 + d8697a8 commit 8e9fc52
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
matrix:
rust:
- 1.66.0
- stable
- 1.73.0
steps:
- name: Checkout sources
uses: actions/checkout@v4.1.0
Expand All @@ -118,7 +118,7 @@ jobs:
matrix:
rust:
- 1.66.0
- stable
- 1.73.0

steps:
- name: Checkout sources
Expand Down
2 changes: 1 addition & 1 deletion examples/async_source/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<F: Format + Send + Sync + Debug> AsyncSource for HttpSource<F> {
.and_then(|text| {
self.format
.parse(Some(&self.uri), &text)
.map_err(|e| ConfigError::Foreign(e))
.map_err(ConfigError::Foreign)
})
}
}
2 changes: 1 addition & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl ConfigBuilder<DefaultState> {
.state
.sources
.into_iter()
.map(|s| SourceType::Sync(s))
.map(SourceType::Sync)
.collect(),
},
defaults: self.defaults,
Expand Down
2 changes: 1 addition & 1 deletion src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ where
let (uri, contents, format) = match self
.source
.resolve(self.format.clone())
.map_err(|err| ConfigError::Foreign(err))
.map_err(ConfigError::Foreign)
{
Ok(result) => (result.uri, result.content, result.format),

Expand Down
25 changes: 16 additions & 9 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ where

impl Display for ValueKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use std::fmt::Write;

match *self {
Self::String(ref value) => write!(f, "{}", value),
Self::Boolean(value) => write!(f, "{}", value),
Expand All @@ -161,15 +163,20 @@ impl Display for ValueKind {
Self::U128(value) => write!(f, "{}", value),
Self::Float(value) => write!(f, "{}", value),
Self::Nil => write!(f, "nil"),
Self::Table(ref table) => write!(f, "{{ {} }}", {
table
.iter()
.map(|(k, v)| format!("{} => {}, ", k, v))
.collect::<String>()
}),
Self::Array(ref array) => write!(f, "{:?}", {
array.iter().map(|e| format!("{}, ", e)).collect::<String>()
}),
Self::Table(ref table) => {
let mut s = String::new();
for (k, v) in table.iter() {
write!(s, "{} => {}, ", k, v)?
}
write!(f, "{{ {s} }}")
}
Self::Array(ref array) => {
let mut s = String::new();
for e in array.iter() {
write!(s, "{}, ", e)?;
}
write!(f, "{s:?}")
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/async_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl AsyncSource for AsyncFile {

self.format
.parse(Some(&self.path), &text)
.map_err(|e| ConfigError::Foreign(e))
.map_err(ConfigError::Foreign)
}
}

Expand Down

0 comments on commit 8e9fc52

Please sign in to comment.