Skip to content

Commit

Permalink
Use style_edition instead of version in .rustfmt.toml and apply new c…
Browse files Browse the repository at this point in the history
…hanges from nightly
  • Loading branch information
d0cd committed Oct 1, 2024
1 parent e9f8561 commit f8805ad
Show file tree
Hide file tree
Showing 115 changed files with 317 additions and 317 deletions.
4 changes: 2 additions & 2 deletions .integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ mod tests {
use aleo_std::StorageMode;
use snarkos_node_cdn::sync_ledger_with_cdn;
use snarkvm::prelude::{
block::Block,
store::helpers::memory::ConsensusMemory,
FromBytes,
Ledger,
MainnetV0,
Network,
block::Block,
store::helpers::memory::ConsensusMemory,
};

use tracing_test::traced_test;
Expand Down
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ imports_layout = "HorizontalVertical"
imports_granularity = "Crate"
overflow_delimited_expr = true
reorder_impl_items = true
version = "Two"
style_edition = "2024"
2 changes: 1 addition & 1 deletion cli/src/commands/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use snarkvm::console::{
types::Field,
};

use anyhow::{anyhow, bail, Result};
use anyhow::{Result, anyhow, bail};
use clap::Parser;
use colored::Colorize;
use core::str::FromStr;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use snarkos_node::bft::helpers::proposal_cache_path;

use aleo_std::StorageMode;
use anyhow::{bail, Result};
use anyhow::{Result, bail};
use clap::Parser;
use colored::Colorize;
use std::path::PathBuf;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/developer/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use snarkvm::{
prelude::{Record, ViewKey},
};

use anyhow::{bail, Result};
use anyhow::{Result, bail};
use clap::Parser;
use std::str::FromStr;
use zeroize::Zeroize;
Expand Down
12 changes: 6 additions & 6 deletions cli/src/commands/developer/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ use snarkvm::{
program::ProgramOwner,
},
prelude::{
block::Transaction,
deployment_cost,
query::Query,
store::{helpers::memory::ConsensusMemory, ConsensusStore},
PrivateKey,
ProgramID,
VM,
block::Transaction,
deployment_cost,
query::Query,
store::{ConsensusStore, helpers::memory::ConsensusMemory},
},
};

use aleo_std::StorageMode;
use anyhow::{bail, Result};
use anyhow::{Result, bail};
use clap::Parser;
use colored::Colorize;
use std::{path::PathBuf, str::FromStr};
Expand Down Expand Up @@ -178,7 +178,7 @@ impl Deploy {
#[cfg(test)]
mod tests {
use super::*;
use crate::commands::{Command, CLI};
use crate::commands::{CLI, Command};

#[test]
fn clap_snarkos_deploy() {
Expand Down
10 changes: 5 additions & 5 deletions cli/src/commands/developer/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ use super::Developer;
use snarkvm::{
console::network::{CanaryV0, MainnetV0, Network, TestnetV0},
prelude::{
query::Query,
store::{helpers::memory::ConsensusMemory, ConsensusStore},
Address,
Identifier,
Locator,
PrivateKey,
Process,
ProgramID,
Value,
VM,
Value,
query::Query,
store::{ConsensusStore, helpers::memory::ConsensusMemory},
},
};

use aleo_std::StorageMode;
use anyhow::{anyhow, bail, Result};
use anyhow::{Result, anyhow, bail};
use clap::Parser;
use colored::Colorize;
use std::{path::PathBuf, str::FromStr};
Expand Down Expand Up @@ -213,7 +213,7 @@ fn load_program<N: Network>(endpoint: &str, process: &mut Process<N>, program_id
#[cfg(test)]
mod tests {
use super::*;
use crate::commands::{Command, CLI};
use crate::commands::{CLI, Command};

#[test]
fn clap_snarkos_execute() {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/developer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ use snarkvm::{
console::network::Network,
package::Package,
prelude::{
block::Transaction,
Address,
Ciphertext,
Identifier,
Expand All @@ -45,10 +44,11 @@ use snarkvm::{
ToBytes,
Value,
ViewKey,
block::Transaction,
},
};

use anyhow::{bail, ensure, Result};
use anyhow::{Result, bail, ensure};
use clap::Parser;
use colored::Colorize;
use std::{path::PathBuf, str::FromStr};
Expand Down
6 changes: 3 additions & 3 deletions cli/src/commands/developer/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

use snarkvm::{
console::network::{CanaryV0, MainnetV0, Network, TestnetV0},
prelude::{block::Block, Ciphertext, Field, FromBytes, Plaintext, PrivateKey, Record, ViewKey},
prelude::{Ciphertext, Field, FromBytes, Plaintext, PrivateKey, Record, ViewKey, block::Block},
};

use anyhow::{bail, ensure, Result};
use anyhow::{Result, bail, ensure};
use clap::Parser;
use parking_lot::RwLock;
use std::{
io::{stdout, Write},
io::{Write, stdout},
str::FromStr,
sync::Arc,
};
Expand Down
8 changes: 4 additions & 4 deletions cli/src/commands/developer/transfer_private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ use super::Developer;
use snarkvm::{
console::network::{CanaryV0, MainnetV0, Network, TestnetV0},
prelude::{
query::Query,
store::{helpers::memory::ConsensusMemory, ConsensusStore},
Address,
Locator,
PrivateKey,
Value,
VM,
Value,
query::Query,
store::{ConsensusStore, helpers::memory::ConsensusMemory},
},
};

use aleo_std::StorageMode;
use anyhow::{bail, Result};
use anyhow::{Result, bail};
use clap::Parser;
use std::{path::PathBuf, str::FromStr};
use zeroize::Zeroize;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub use update::*;

use anstyle::{AnsiColor, Color, Style};
use anyhow::Result;
use clap::{builder::Styles, Parser};
use clap::{Parser, builder::Styles};

const HEADER_COLOR: Option<Color> = Some(Color::Ansi(AnsiColor::Yellow));
const LITERAL_COLOR: Option<Color> = Some(Color::Ansi(AnsiColor::Green));
Expand Down
10 changes: 5 additions & 5 deletions cli/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use snarkos_account::Account;
use snarkos_display::Display;
use snarkos_node::{bft::MEMORY_POOL_PORT, router::messages::NodeType, Node};
use snarkos_node::{Node, bft::MEMORY_POOL_PORT, router::messages::NodeType};
use snarkvm::{
console::{
account::{Address, PrivateKey},
Expand All @@ -25,15 +25,15 @@ use snarkvm::{
ledger::{
block::Block,
committee::{Committee, MIN_DELEGATOR_STAKE, MIN_VALIDATOR_STAKE},
store::{helpers::memory::ConsensusMemory, ConsensusStore},
store::{ConsensusStore, helpers::memory::ConsensusMemory},
},
prelude::{FromBytes, ToBits, ToBytes},
synthesizer::VM,
utilities::to_bytes_le,
};

use aleo_std::StorageMode;
use anyhow::{bail, ensure, Result};
use anyhow::{Result, bail, ensure};
use clap::Parser;
use colored::Colorize;
use core::str::FromStr;
Expand All @@ -44,7 +44,7 @@ use serde::{Deserialize, Serialize};
use std::{
net::SocketAddr,
path::PathBuf,
sync::{atomic::AtomicBool, Arc},
sync::{Arc, atomic::AtomicBool},
};
use tokio::runtime::{self, Runtime};

Expand Down Expand Up @@ -767,7 +767,7 @@ fn load_or_compute_genesis<N: Network>(
#[cfg(test)]
mod tests {
use super::*;
use crate::commands::{Command, CLI};
use crate::commands::{CLI, Command};
use snarkvm::prelude::MainnetV0;

type CurrentNetwork = MainnetV0;
Expand Down
6 changes: 3 additions & 3 deletions cli/src/helpers/dynamic_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
// limitations under the License.

use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
atomic::{AtomicBool, Ordering},
};

use time::{
format_description::{self, OwnedFormatItem},
OffsetDateTime,
format_description::{self, OwnedFormatItem},
};
use tracing::{Event, Subscriber};
use tracing_subscriber::{
fmt::{format::Writer, FmtContext, FormatEvent, FormatFields},
fmt::{FmtContext, FormatEvent, FormatFields, format::Writer},
registry::LookupSpan,
};

Expand Down
4 changes: 2 additions & 2 deletions cli/src/helpers/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ use std::{
fs::File,
io,
path::Path,
sync::{atomic::AtomicBool, Arc},
sync::{Arc, atomic::AtomicBool},
};
use tokio::sync::mpsc;
use tracing_subscriber::{
EnvFilter,
layer::{Layer, SubscriberExt},
util::SubscriberInitExt,
EnvFilter,
};

/// Initializes the logger.
Expand Down
2 changes: 1 addition & 1 deletion cli/src/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use snarkos_node::router::messages::NodeType;

use colored::*;
#[cfg(target_family = "unix")]
use nix::sys::resource::{getrlimit, Resource};
use nix::sys::resource::{Resource, getrlimit};

/// Check if process's open files limit is above minimum and warn if not.
#[cfg(target_family = "unix")]
Expand Down
2 changes: 1 addition & 1 deletion cli/src/helpers/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.

use colored::Colorize;
use self_update::{backends::github, version::bump_is_greater, Status};
use self_update::{Status, backends::github, version::bump_is_greater};
use std::fmt::Write;

pub struct Updater;
Expand Down
6 changes: 3 additions & 3 deletions display/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ use anyhow::Result;
use crossterm::{
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
};
use ratatui::{
Frame,
Terminal,
backend::{Backend, CrosstermBackend},
layout::{Constraint, Direction, Layout},
style::{Color, Modifier, Style},
text::{Line, Span},
widgets::{Block, Borders, Tabs as TabsTui},
Frame,
Terminal,
};
use std::{
io,
Expand Down
2 changes: 1 addition & 1 deletion display/src/pages/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// limitations under the License.

use ratatui::{
Frame,
layout::{Constraint, Direction, Layout, Rect},
widgets::{Block, Borders, Paragraph},
Frame,
};
use std::collections::VecDeque;
use tokio::sync::mpsc;
Expand Down
4 changes: 2 additions & 2 deletions display/src/pages/overview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ use snarkos_node::Node;
use snarkvm::prelude::Network;

use ratatui::{
Frame,
layout::{Constraint, Direction, Layout, Rect},
style::{Color, Style},
text::Span,
widgets::{canvas::Canvas, Block, Borders},
Frame,
widgets::{Block, Borders, canvas::Canvas},
};

pub(crate) struct Overview;
Expand Down
2 changes: 1 addition & 1 deletion node/bft/events/src/batch_certified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<N: Network> FromBytes for BatchCertified<N> {

#[cfg(test)]
pub mod prop_tests {
use crate::{certificate_response::prop_tests::any_batch_certificate, BatchCertified};
use crate::{BatchCertified, certificate_response::prop_tests::any_batch_certificate};
use snarkvm::console::prelude::{FromBytes, ToBytes};

use bytes::{Buf, BufMut, BytesMut};
Expand Down
4 changes: 2 additions & 2 deletions node/bft/events/src/batch_propose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ impl<N: Network> FromBytes for BatchPropose<N> {

#[cfg(test)]
pub mod prop_tests {
use crate::{certificate_response::prop_tests::any_batch_header, BatchPropose};
use crate::{BatchPropose, certificate_response::prop_tests::any_batch_header};
use snarkvm::{
console::prelude::{FromBytes, ToBytes},
ledger::committee::prop_tests::CommitteeContext,
prelude::narwhal::Data,
};

use bytes::{Buf, BufMut, BytesMut};
use proptest::prelude::{any, BoxedStrategy, Strategy};
use proptest::prelude::{BoxedStrategy, Strategy, any};
use test_strategy::proptest;

type CurrentNetwork = snarkvm::prelude::MainnetV0;
Expand Down
2 changes: 1 addition & 1 deletion node/bft/events/src/batch_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ impl<N: Network> FromBytes for BatchSignature<N> {
#[cfg(test)]
pub mod prop_tests {
use crate::{
BatchSignature,
certificate_request::prop_tests::any_field,
challenge_response::prop_tests::any_signature,
BatchSignature,
};
use snarkvm::console::prelude::{FromBytes, ToBytes};

Expand Down
2 changes: 1 addition & 1 deletion node/bft/events/src/block_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub mod prop_tests {
use crate::BlockRequest;

use bytes::{Buf, BufMut, BytesMut};
use proptest::prelude::{any, BoxedStrategy, Strategy};
use proptest::prelude::{BoxedStrategy, Strategy, any};
use snarkvm::utilities::{FromBytes, ToBytes};
use test_strategy::proptest;

Expand Down
6 changes: 3 additions & 3 deletions node/bft/events/src/block_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ impl<N: Network> FromBytes for DataBlocks<N> {

#[cfg(test)]
pub mod prop_tests {
use crate::{block_request::prop_tests::any_block_request, BlockResponse, DataBlocks};
use crate::{BlockResponse, DataBlocks, block_request::prop_tests::any_block_request};
use snarkvm::{
ledger::ledger_test_helpers::sample_genesis_block,
prelude::{block::Block, narwhal::Data, FromBytes, TestRng, ToBytes},
prelude::{FromBytes, TestRng, ToBytes, block::Block, narwhal::Data},
};

use bytes::{Buf, BufMut, BytesMut};
use proptest::{
collection::vec,
prelude::{any, BoxedStrategy, Strategy},
prelude::{BoxedStrategy, Strategy, any},
};
use test_strategy::proptest;

Expand Down
Loading

0 comments on commit f8805ad

Please sign in to comment.