Fix Nightly Clippy Warnings (backport #18065) (#18070)

* chore: cargo +nightly clippy --fix -Z unstable-options

(cherry picked from commit 6514096a67)

# Conflicts:
#	core/src/banking_stage.rs
#	core/src/cost_model.rs
#	core/src/cost_tracker.rs
#	core/src/execute_cost_table.rs
#	core/src/replay_stage.rs
#	core/src/tvu.rs
#	ledger-tool/src/main.rs
#	programs/bpf_loader/build.rs
#	rbpf-cli/src/main.rs
#	sdk/cargo-build-bpf/src/main.rs
#	sdk/cargo-test-bpf/src/main.rs
#	sdk/src/secp256k1_instruction.rs

* chore: cargo fmt

(cherry picked from commit 789f33e8db)

* Updates BPF program assert_instruction_count tests.

(cherry picked from commit c1e03f3410)

# Conflicts:
#	programs/bpf/tests/programs.rs

* Resolve conflicts

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
mergify[bot]
2021-06-18 20:02:48 +00:00
committed by GitHub
parent c330016109
commit 0e7512a225
173 changed files with 1250 additions and 1056 deletions

View File

@@ -548,7 +548,7 @@ pub fn init(
init_or_update(config_file, true, false)?;
let path_modified = if !no_modify_path {
add_to_path(&config.active_release_bin_dir().to_str().unwrap())
add_to_path(config.active_release_bin_dir().to_str().unwrap())
} else {
false
};
@@ -613,10 +613,10 @@ pub fn info(config_file: &str, local_info_only: bool, eval: bool) -> Result<(),
return Ok(());
}
println_name_value("Configuration:", &config_file);
println_name_value("Configuration:", config_file);
println_name_value(
"Active release directory:",
&config.active_release_dir().to_str().unwrap_or("?"),
config.active_release_dir().to_str().unwrap_or("?"),
);
fn print_release_version(config: &Config) {
@@ -633,14 +633,14 @@ pub fn info(config_file: &str, local_info_only: bool, eval: bool) -> Result<(),
if let Some(explicit_release) = &config.explicit_release {
match explicit_release {
ExplicitRelease::Semver(release_semver) => {
println_name_value(&format!("{}Release version:", BULLET), &release_semver);
println_name_value(&format!("{}Release version:", BULLET), release_semver);
println_name_value(
&format!("{}Release URL:", BULLET),
&github_release_download_url(release_semver),
);
}
ExplicitRelease::Channel(release_channel) => {
println_name_value(&format!("{}Release channel:", BULLET), &release_channel);
println_name_value(&format!("{}Release channel:", BULLET), release_channel);
println_name_value(
&format!("{}Release URL:", BULLET),
&release_channel_download_url(release_channel),
@@ -659,7 +659,7 @@ pub fn info(config_file: &str, local_info_only: bool, eval: bool) -> Result<(),
Some(ref update_manifest) => {
println_name_value("Installed version:", "");
print_release_version(&config);
print_update_manifest(&update_manifest);
print_update_manifest(update_manifest);
}
None => {
println_name_value("Installed version:", "None");

View File

@@ -18,7 +18,7 @@ mod stop_process;
mod update_manifest;
pub fn is_semver(semver: &str) -> Result<(), String> {
match semver::Version::parse(&semver) {
match semver::Version::parse(semver) {
Ok(_) => Ok(()),
Err(err) => Err(format!("{:?}", err)),
}
@@ -60,10 +60,10 @@ pub fn explicit_release_of(
fn handle_init(matches: &ArgMatches<'_>, config_file: &str) -> Result<(), String> {
let json_rpc_url = matches.value_of("json_rpc_url").unwrap();
let update_manifest_pubkey = pubkey_of(&matches, "update_manifest_pubkey");
let update_manifest_pubkey = pubkey_of(matches, "update_manifest_pubkey");
let data_dir = matches.value_of("data_dir").unwrap();
let no_modify_path = matches.is_present("no_modify_path");
let explicit_release = explicit_release_of(&matches, "explicit_release");
let explicit_release = explicit_release_of(matches, "explicit_release");
if update_manifest_pubkey.is_none() && explicit_release.is_none() {
Err(format!(
@@ -98,7 +98,7 @@ pub fn main() -> Result<(), String> {
.global(true)
.help("Configuration file to use");
match *defaults::CONFIG_FILE {
Some(ref config_file) => arg.default_value(&config_file),
Some(ref config_file) => arg.default_value(config_file),
None => arg.required(true),
}
})
@@ -115,7 +115,7 @@ pub fn main() -> Result<(), String> {
.required(true)
.help("Directory to store install data");
match *defaults::DATA_DIR {
Some(ref data_dir) => arg.default_value(&data_dir),
Some(ref data_dir) => arg.default_value(data_dir),
None => arg,
}
})
@@ -181,7 +181,7 @@ pub fn main() -> Result<(), String> {
.required(true)
.help("Keypair file of the account that funds the deployment");
match *defaults::USER_KEYPAIR {
Some(ref config_file) => arg.default_value(&config_file),
Some(ref config_file) => arg.default_value(config_file),
None => arg,
}
})
@@ -242,7 +242,7 @@ pub fn main() -> Result<(), String> {
let config_file = matches.value_of("config_file").unwrap();
match matches.subcommand() {
("init", Some(matches)) => handle_init(&matches, &config_file),
("init", Some(matches)) => handle_init(matches, config_file),
("info", Some(matches)) => {
let local_info_only = matches.is_present("local_info_only");
let eval = matches.is_present("eval");
@@ -290,7 +290,7 @@ pub fn main_init() -> Result<(), String> {
.takes_value(true)
.help("Configuration file to use");
match *defaults::CONFIG_FILE {
Some(ref config_file) => arg.default_value(&config_file),
Some(ref config_file) => arg.default_value(config_file),
None => arg.required(true),
}
})
@@ -303,7 +303,7 @@ pub fn main_init() -> Result<(), String> {
.required(true)
.help("Directory to store install data");
match *defaults::DATA_DIR {
Some(ref data_dir) => arg.default_value(&data_dir),
Some(ref data_dir) => arg.default_value(data_dir),
None => arg,
}
})
@@ -342,5 +342,5 @@ pub fn main_init() -> Result<(), String> {
.get_matches();
let config_file = matches.value_of("config_file").unwrap();
handle_init(&matches, &config_file)
handle_init(&matches, config_file)
}