Skip to content

Commit

Permalink
chore(cargo): adapt codebase to latest Rust (1.77)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommytrg authored and aesedepece committed May 27, 2024
1 parent 0494905 commit 4f3f56b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bridges/centralized-ethereum/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn from_env() -> Result<Config, envy::Error> {
thread_local! {
/// Thread-local flag to indicate the `nested_toml_if_using_envy` function that we are indeed
/// using envy.
static USING_ENVY: Cell<bool> = Cell::new(false);
static USING_ENVY: Cell<bool> = const { Cell::new(false) };
}

/// If using the `envy` crate to deserialize this value, try to deserialize it as a TOML string.
Expand Down
2 changes: 1 addition & 1 deletion config/src/loaders/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn from_str(contents: &str) -> Result<PartialConfig, toml::de::Error> {
}

#[cfg(test)]
thread_local!(static FILE_CONTENTS: Cell<&'static str> = Cell::new(""));
thread_local!(static FILE_CONTENTS: Cell<&'static str> = const { Cell::new("") });

#[cfg(test)]
fn read_file_contents(_filename: &Path, contents: &mut String) -> io::Result<usize> {
Expand Down
2 changes: 2 additions & 0 deletions net/src/server/ws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ pub use error::Error;

type PubSubHandler = pubsub::PubSubHandler<Arc<pubsub::Session>>;

// We need to pass the server as an argument to avoid dropping it before the start had finished
/// TODO: doc
#[allow(dead_code)]
pub struct Server(server::Server);

impl Server {
Expand Down
2 changes: 1 addition & 1 deletion rad/src/operators/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn inner_get(input: &RadonArray, args: &[Value]) -> Result<RadonTypes, RadError>
input
.value()
.get(index)
.map(Clone::clone)
.cloned()
.ok_or_else(|| not_found(index))
}

Expand Down
2 changes: 1 addition & 1 deletion rad/src/operators/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn inner_get(input: &RadonMap, args: &[Value]) -> Result<RadonTypes, RadError> {
input
.value()
.get(&key)
.map(Clone::clone)
.cloned()
.ok_or_else(|| not_found(key))
}

Expand Down
6 changes: 3 additions & 3 deletions src/cli/node/json_rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1728,10 +1728,10 @@ struct JsonRpcError {
/// Id. Can be null, a number, or a string
#[derive(Debug, Deserialize)]
#[serde(untagged)]
enum Id<'a> {
enum Id {
Null,
Number(u64),
String(&'a str),
Number(),
String(),
}

/// A failed request returns an error with code and message
Expand Down
10 changes: 5 additions & 5 deletions wallet/src/actors/worker/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,37 +618,37 @@ impl Worker {
.body
.outputs
.get(output.output_index as usize)
.map(ValueTransferOutput::clone)
.cloned()
.ok_or_else(|| {
Error::OutputIndexNotFound(output.output_index, format!("{:?}", txn))
}),
Transaction::DataRequest(dr) => dr
.body
.outputs
.get(output.output_index as usize)
.map(ValueTransferOutput::clone)
.cloned()
.ok_or_else(|| {
Error::OutputIndexNotFound(output.output_index, format!("{:?}", txn))
}),
Transaction::Tally(tally) => tally
.outputs
.get(output.output_index as usize)
.map(ValueTransferOutput::clone)
.cloned()
.ok_or_else(|| {
Error::OutputIndexNotFound(output.output_index, format!("{:?}", txn))
}),
Transaction::Mint(mint) => mint
.outputs
.get(output.output_index as usize)
.map(ValueTransferOutput::clone)
.cloned()
.ok_or_else(|| {
Error::OutputIndexNotFound(output.output_index, format!("{:?}", txn))
}),
Transaction::Commit(commit) => commit
.body
.outputs
.get(output.output_index as usize)
.map(ValueTransferOutput::clone)
.cloned()
.ok_or_else(|| {
Error::OutputIndexNotFound(output.output_index, format!("{:?}", txn))
}),
Expand Down

0 comments on commit 4f3f56b

Please sign in to comment.