Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting #2836

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/cheatnet/src/forking/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl ForkCache {
file.write_all(output.as_bytes())
.expect("Could not write cache to file");

file.unlock().unwrap();
fs2::FileExt::unlock(&file).unwrap();
}

pub(crate) fn get_storage_at(
Expand Down
2 changes: 1 addition & 1 deletion crates/data-transformer/src/sierra_abi/complex_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl SupportedCalldataKind for ExprStructCtorCall {
{
// TODO add message which arguments are invalid (Issue #2549)
bail!(
r#"Arguments in constructor invocation for struct {} do not match struct arguments in ABI"#,
r"Arguments in constructor invocation for struct {} do not match struct arguments in ABI",
expected_type
)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/forge-runner/src/coverage_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ pub fn can_coverage_be_generated(scarb_metadata: &Metadata) -> Result<()> {
fn contains_entry_with_value(table: &Table, key: &str, value: &str) -> bool {
table
.get(key)
.map_or(false, |entry| entry.to_string().trim() == value)
.is_some_and(|entry| entry.to_string().trim() == value)
}
2 changes: 1 addition & 1 deletion crates/forge-runner/src/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pub fn check_available_gas(
arguments,
gas_info,
..
} if available_gas.map_or(false, |available_gas| gas_info > available_gas as u128) => {
} if available_gas.is_some_and(|available_gas| gas_info > available_gas as u128) => {
TestCaseSummary::Failed {
name,
msg: Some(format!(
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/tests/e2e/running.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,11 +1122,11 @@ fn catch_runtime_errors() {
assert_stdout_contains(
output,
formatdoc!(
r#"
r"
[..]Compiling[..]
[..]Finished[..]
[PASS] simple_package_integrationtest::test::catch_no_such_file [..]
"#
"
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/scarb-api/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl VersionCommand {
fn extract_version(version_output: &str, tool: &str) -> Result<Version> {
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
let version_regex = Regex::new(
&format!(r#"{tool}?\s*((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)"#))
&format!(r"{tool}?\s*((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)"))
.context("Could not create version matching regex")?;

let version_capture = version_regex
Expand Down
4 changes: 2 additions & 2 deletions crates/sncast/src/helpers/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ mod tests {

#[test]
fn test_create_table() {
let original = formatdoc! {r#"
let original = formatdoc! {r"
[snfoundry]
key = 2137
"#};
"};

let expected = formatdoc! {
r#"
Expand Down
4 changes: 2 additions & 2 deletions crates/sncast/src/starknet_commands/account/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ where
Ok((deployment.address(), get_deployment_fee(&deployment).await?))
}

async fn get_deployment_fee<'a, T>(
account_deployment: &AccountDeploymentV1<'a, T>,
async fn get_deployment_fee<T>(
account_deployment: &AccountDeploymentV1<'_, T>,
) -> Result<FeeEstimate>
where
T: AccountFactory + Sync,
Expand Down
4 changes: 2 additions & 2 deletions crates/sncast/src/starknet_commands/script/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ fn overwrite_lib_file(script_name: &str, script_root_dir: &Utf8PathBuf) -> Resul

fs::write(
lib_file_path,
formatdoc! {r#"
formatdoc! {r"
mod {script_name};
"#},
"},
)?;

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions crates/sncast/tests/e2e/script/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ fn test_script_init_happy_case() {

assert_eq!(
lib_cairo_content,
formatdoc! {r#"
formatdoc! {r"
mod {script_name};
"#}
"}
);
assert_eq!(
main_file_content,
Expand Down
2 changes: 1 addition & 1 deletion crates/snforge-scarb-plugin/src/attributes/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn from_file_args(db: &dyn SyntaxGroup, args: &Arguments) -> Result<String, Diag
let name = name.as_cairo_expression();

Ok(format!(
r#"snforge_std::_config_types::ForkConfig::Named({name})"#
r"snforge_std::_config_types::ForkConfig::Named({name})"
))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl CairoExpression for Expected {
Self::ByteArray(string) => {
let string = string.as_cairo_expression();

format!(r#"snforge_std::_config_types::Expected::ByteArray({string})"#)
format!(r"snforge_std::_config_types::Expected::ByteArray({string})")
}
Self::Array(strings) => {
let arr = strings.as_cairo_expression();
Expand Down
4 changes: 2 additions & 2 deletions crates/snforge-scarb-plugin/src/config_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ where
let cheatcode_name = Collector::CHEATCODE_NAME;

let config_cheatcode = formatdoc!(
r#"
r"
let mut data = array![];

{value}
.serialize(ref data);

starknet::testing::cheatcode::<'{cheatcode_name}'>(data.span());
"#
"
);

Ok(append_config_statements(db, func, &config_cheatcode))
Expand Down
Loading