Skip to content

Commit

Permalink
🦖 fix clippy format string errors (#930)
Browse files Browse the repository at this point in the history
* Cargo.lock

* Clippy

* Fmt
  • Loading branch information
ascjones authored Jan 26, 2023
1 parent 06babac commit c833122
Show file tree
Hide file tree
Showing 28 changed files with 117 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct_field_align_threshold = 0
enum_discrim_align_threshold = 0
match_arm_blocks = true
force_multiline_blocks = true # changed
fn_args_layout = "Tall"
fn_params_layout = "Tall"
brace_style = "SameLineWhere"
control_brace_style = "AlwaysSameLine"
trailing_semicolon = false # changed
Expand Down
82 changes: 50 additions & 32 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/build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn main() {
match res {
Ok(()) => std::process::exit(0),
Err(err) => {
eprintln!("Encountered error: {:?}", err);
eprintln!("Encountered error: {err:?}");
std::process::exit(1)
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/build/src/crate_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ fn get_cargo_toml_metadata(manifest_path: &ManifestPath) -> Result<ExtraMetadata
.and_then(|v| v.as_str())
.map(Url::parse)
.transpose()
.context(format!("{} should be a valid URL", field_name))
.context(format!("{field_name} should be a valid URL"))
.map_err(Into::into)
};

Expand Down
15 changes: 7 additions & 8 deletions crates/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,9 @@ fn assert_compatible_ink_dependencies(
let _ = util::invoke_cargo("tree", args, manifest_path.directory(), verbosity, vec![])
.with_context(|| {
format!(
"Mismatching versions of `{}` were found!\n\
"Mismatching versions of `{dependency}` were found!\n\
Please ensure that your contract and your ink! dependencies use a compatible \
version of this package.",
dependency
version of this package."
)
})?;
}
Expand Down Expand Up @@ -601,7 +600,7 @@ pub fn execute(args: ExecuteArgs) -> Result<BuildResult> {
maybe_println!(
verbosity,
" {} {}",
format!("{}", steps).bold(),
format!("{steps}").bold(),
"Checking ink! linting rules".bright_green().bold()
);
steps.increment_current();
Expand All @@ -618,7 +617,7 @@ pub fn execute(args: ExecuteArgs) -> Result<BuildResult> {
maybe_println!(
verbosity,
" {} {}",
format!("{}", build_steps).bold(),
format!("{build_steps}").bold(),
"Building cargo project".bright_green().bold()
);
build_steps.increment_current();
Expand All @@ -635,7 +634,7 @@ pub fn execute(args: ExecuteArgs) -> Result<BuildResult> {
maybe_println!(
verbosity,
" {} {}",
format!("{}", build_steps).bold(),
format!("{build_steps}").bold(),
"Post processing wasm file".bright_green().bold()
);
build_steps.increment_current();
Expand All @@ -644,7 +643,7 @@ pub fn execute(args: ExecuteArgs) -> Result<BuildResult> {
maybe_println!(
verbosity,
" {} {}",
format!("{}", build_steps).bold(),
format!("{build_steps}").bold(),
"Optimizing wasm file".bright_green().bold()
);
build_steps.increment_current();
Expand Down Expand Up @@ -684,7 +683,7 @@ pub fn execute(args: ExecuteArgs) -> Result<BuildResult> {
maybe_println!(
verbosity,
" {} {}",
format!("{}", build_steps).bold(),
format!("{build_steps}").bold(),
"Executing `cargo check`".bright_green().bold()
);
exec_cargo_for_wasm_target(
Expand Down
4 changes: 2 additions & 2 deletions crates/build/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub(crate) fn execute(
maybe_println!(
verbosity,
" {} {}",
format!("{}", build_steps).bold(),
format!("{build_steps}").bold(),
"Generating metadata".bright_green().bold()
);
let target_dir_arg = format!(
Expand Down Expand Up @@ -168,7 +168,7 @@ pub(crate) fn execute(
maybe_println!(
verbosity,
" {} {}",
format!("{}", build_steps).bold(),
format!("{build_steps}").bold(),
"Generating bundle".bright_green().bold()
);
let contents = serde_json::to_string(&metadata)?;
Expand Down
3 changes: 1 addition & 2 deletions crates/build/src/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use std::{
Cursor,
Read,
Seek,
SeekFrom,
Write,
},
path::{
Expand Down Expand Up @@ -77,7 +76,7 @@ where
fn unzip(template: &[u8], out_dir: PathBuf, name: Option<&str>) -> Result<()> {
let mut cursor = Cursor::new(Vec::new());
cursor.write_all(template)?;
cursor.seek(SeekFrom::Start(0))?;
cursor.rewind()?;

let mut archive = zip::ZipArchive::new(cursor)?;

Expand Down
Loading

0 comments on commit c833122

Please sign in to comment.