Skip to content

Commit

Permalink
Use nightly for rustfmt in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasPickering committed Nov 21, 2023
1 parent 1fd1ddb commit 460b9bf
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: Rustfmt
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2023-09-20 # Semi-arbitrary
command: fmt
args: -- --check

Expand Down
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
max_width = 80
# these two are only available on nightly (F)
merge_imports = true
imports_granularity = "crate"
wrap_comments = true
8 changes: 3 additions & 5 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,10 @@ impl Subcommand {
.truncate(true)
.write(true)
.open(&output_file)
.with_context(|| {
format!(
"Error opening collection output file \
.context(format!(
"Error opening collection output file \
{output_file:?}"
)
})?,
))?,
),
None => Box::new(io::stdout()),
};
Expand Down
2 changes: 1 addition & 1 deletion src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl RequestCollection<PathBuf> {

Ok(future
.await
.with_context(|| format!("Error loading collection from {path:?}"))?
.context(format!("Error loading collection from {path:?}"))?
.with_source(path))
}

Expand Down
15 changes: 6 additions & 9 deletions src/collection/insomnia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ impl RequestCollection<()> {
is meant to give you a skeleton for a Slumber collection, and \
nothing more."
);
let file = File::open(insomnia_file).with_context(|| {
format!("Error opening Insomnia collection file {insomnia_file:?}")
})?;
let file = File::open(insomnia_file).context(format!(
"Error opening Insomnia collection file {insomnia_file:?}"
))?;
// The format can be YAML or JSON, so we can just treat it all as YAML
let insomnia: Insomnia =
serde_yaml::from_reader(file).with_context(|| {
format!(
"Error deserializing Insomnia collection file\
{insomnia_file:?}"
)
})?;
serde_yaml::from_reader(file).context(format!(
"Error deserializing Insomnia collection file {insomnia_file:?}"
))?;

// Convert everything
let mut profiles = Vec::new();
Expand Down
12 changes: 6 additions & 6 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ impl RequestBuilder {
// String -> header conversions are fallible, if headers
// are invalid
Ok::<(HeaderName, HeaderValue), anyhow::Error>((
header.try_into().with_context(|| {
format!("Error parsing header name `{header}`")
})?,
value.try_into().with_context(|| {
format!("Error parsing value for header `{header}`")
})?,
header
.try_into()
.context(format!("Error parsing header name `{header}`"))?,
value.try_into().context(format!(
"Error parsing value for header `{header}`"
))?,
))
});
Ok(future::try_join_all(iter)
Expand Down
2 changes: 0 additions & 2 deletions src/http/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ pub struct Repository {
impl Repository {
/// Load the repository database. This will perform first-time setup, so
/// this should only be called at the main session entrypoint.
///
/// Each collection gets its own
pub fn load(collection_id: &CollectionId) -> anyhow::Result<Self> {
let mut connection = Connection::open(Self::path(collection_id))?;
// Use WAL for concurrency
Expand Down

0 comments on commit 460b9bf

Please sign in to comment.