Skip to content

Commit

Permalink
fix: Warnings after Rust 1.80 update
Browse files Browse the repository at this point in the history
  • Loading branch information
jbencin committed Aug 9, 2024
1 parent 5aa1ed5 commit b9d332b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 20 deletions.
2 changes: 2 additions & 0 deletions clarity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ developer-mode = ["stacks_common/developer-mode"]
slog_json = ["stacks_common/slog_json"]
testing = ["canonical"]
devtools = []
rollback_value_check = []
disable-costs = []
16 changes: 8 additions & 8 deletions clarity/src/vm/database/key_value_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ use crate::vm::types::{
};
use crate::vm::{StacksEpoch, Value};

#[cfg(rollback_value_check)]
#[cfg(feature = "rollback_value_check")]
type RollbackValueCheck = String;
#[cfg(not(rollback_value_check))]
#[cfg(not(feature = "rollback_value_check"))]
type RollbackValueCheck = ();

#[cfg(not(rollback_value_check))]
#[cfg(not(feature = "rollback_value_check"))]
fn rollback_value_check(_value: &str, _check: &RollbackValueCheck) {}

#[cfg(not(rollback_value_check))]
#[cfg(not(feature = "rollback_value_check"))]
fn rollback_edits_push<T>(edits: &mut Vec<(T, RollbackValueCheck)>, key: T, _value: &str) {
edits.push((key, ()));
}
// this function is used to check the lookup map when committing at the "bottom" of the
// wrapper -- i.e., when committing to the underlying store. for the _unchecked_ implementation
// this is used to get the edit _value_ out of the lookupmap, for used in the subsequent `put_all`
// command.
#[cfg(not(rollback_value_check))]
#[cfg(not(feature = "rollback_value_check"))]
fn rollback_check_pre_bottom_commit<T>(
edits: Vec<(T, RollbackValueCheck)>,
lookup_map: &mut HashMap<T, Vec<String>>,
Expand All @@ -71,11 +71,11 @@ where
output
}

#[cfg(rollback_value_check)]
#[cfg(feature = "rollback_value_check")]
fn rollback_value_check(value: &String, check: &RollbackValueCheck) {
assert_eq!(value, check)
}
#[cfg(rollback_value_check)]
#[cfg(feature = "rollback_value_check")]
fn rollback_edits_push<T>(edits: &mut Vec<(T, RollbackValueCheck)>, key: T, value: &String)
where
T: Eq + Hash + Clone,
Expand All @@ -84,7 +84,7 @@ where
}
// this function is used to check the lookup map when committing at the "bottom" of the
// wrapper -- i.e., when committing to the underlying store.
#[cfg(rollback_value_check)]
#[cfg(feature = "rollback_value_check")]
fn rollback_check_pre_bottom_commit<T>(
edits: Vec<(T, RollbackValueCheck)>,
lookup_map: &mut HashMap<T, Vec<String>>,
Expand Down
4 changes: 4 additions & 0 deletions stacks-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ canonical = ["rusqlite"]
developer-mode = []
slog_json = ["slog-json"]
testing = ["canonical"]
serde = []
clippy = []
bech32_std = []
bech32_strict = []

[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
sha2 = { version = "0.10", features = ["asm"] }
Expand Down
16 changes: 8 additions & 8 deletions stacks-common/src/deps_common/bech32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//! has more details.
//!
#![cfg_attr(
feature = "std",
feature = "bech32_std",
doc = "
# Examples
```
Expand All @@ -54,20 +54,20 @@ assert_eq!(variant, Variant::Bech32);
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![cfg_attr(feature = "bech32_strict", deny(warnings))]

#[cfg(all(not(feature = "std"), not(test)))]
#[cfg(all(not(feature = "bech32_std"), not(test)))]
extern crate alloc;

#[cfg(any(test, feature = "std"))]
#[cfg(any(test, feature = "bech32_std"))]
extern crate core;

#[cfg(all(not(feature = "std"), not(test)))]
#[cfg(all(not(feature = "bech32_std"), not(test)))]
use alloc::borrow::Cow;
#[cfg(all(not(feature = "std"), not(test)))]
#[cfg(all(not(feature = "bech32_std"), not(test)))]
use alloc::{string::String, vec::Vec};
use core::{fmt, mem};
#[cfg(any(feature = "std", test))]
#[cfg(any(feature = "bech32_std", test))]
use std::borrow::Cow;

/// Integer in the range `0..32`
Expand Down Expand Up @@ -690,7 +690,7 @@ impl fmt::Display for Error {
}
}

#[cfg(any(feature = "std", test))]
#[cfg(any(feature = "bech32_std", test))]
impl std::error::Error for Error {
fn description(&self) -> &str {
match *self {
Expand Down
1 change: 0 additions & 1 deletion stacks-common/src/deps_common/httparse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#![cfg_attr(test, deny(warnings))]
// we can't upgrade while supporting Rust 1.3
#![allow(deprecated)]
#![cfg_attr(httparse_min_2018, allow(rust_2018_idioms))]

//! # httparse
//!
Expand Down
3 changes: 0 additions & 3 deletions stackslib/src/clarity_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ macro_rules! panic_test {
};
}

#[cfg_attr(tarpaulin, skip)]
fn print_usage(invoked_by: &str) {
eprintln!(
"Usage: {} [command]
Expand All @@ -129,15 +128,13 @@ where command is one of:
panic_test!()
}

#[cfg_attr(tarpaulin, skip)]
fn friendly_expect<A, B: std::fmt::Display>(input: Result<A, B>, msg: &str) -> A {
input.unwrap_or_else(|e| {
eprintln!("{}\nCaused by: {}", msg, e);
panic_test!();
})
}

#[cfg_attr(tarpaulin, skip)]
fn friendly_expect_opt<A>(input: Option<A>, msg: &str) -> A {
input.unwrap_or_else(|| {
eprintln!("{}", msg);
Expand Down
1 change: 1 addition & 0 deletions testnet/stacks-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ monitoring_prom = ["stacks/monitoring_prom", "libsigner/monitoring_prom", "stack
slog_json = ["stacks/slog_json", "stacks-common/slog_json", "clarity/slog_json"]
prod-genesis-chainstate = []
default = []
testing = []

0 comments on commit b9d332b

Please sign in to comment.