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

update formatting to latest nightly rules #585

Merged
merged 1 commit into from
Sep 23, 2024
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
4 changes: 2 additions & 2 deletions apps/app-loader/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::io::Read;

use gam::{
menu_matic, Gam, MenuItem, MenuMatic, TextEntryPayload, UxRegistration, APP_MENU_0_APP_LOADER,
APP_MENU_1_APP_LOADER, APP_NAME_APP_LOADER,
APP_MENU_0_APP_LOADER, APP_MENU_1_APP_LOADER, APP_NAME_APP_LOADER, Gam, MenuItem, MenuMatic,
TextEntryPayload, UxRegistration, menu_matic,
};
use locales::t;
use modals::Modals;
Expand Down
10 changes: 5 additions & 5 deletions apps/hello/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ impl Hello {
self.gam
.draw_rectangle(
self.content,
Rectangle::new_with_style(
Point::new(0, 0),
self.screensize,
DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 },
),
Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
}),
)
.expect("can't clear content area");
}
Expand Down
10 changes: 5 additions & 5 deletions apps/hidv2/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ impl HIDv2Demo {
self.gam
.draw_rectangle(
self.content,
Rectangle::new_with_style(
Point::new(0, 0),
self.screensize,
DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 },
),
Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
}),
)
.expect("can't clear content area");
}
Expand Down
2 changes: 1 addition & 1 deletion apps/mtxcli/src/cmds/heap.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::fmt::Write;

use crate::{heap_usage, CommonEnv, ShellCmdApi};
use crate::{CommonEnv, ShellCmdApi, heap_usage};

#[derive(Debug)]
pub struct Heap {}
Expand Down
10 changes: 5 additions & 5 deletions apps/transientdisk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ impl UI {
self.gam
.draw_rectangle(
self.content,
Rectangle::new_with_style(
Point::new(0, 0),
self.screensize,
DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 },
),
Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
}),
)
.expect("can't clear content area");
}
Expand Down
18 changes: 7 additions & 11 deletions apps/vault/src/prereqs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt::Write;
use std::net::{SocketAddr, ToSocketAddrs, UdpSocket};
use std::sync::{atomic::AtomicBool, atomic::Ordering, Arc};
use std::sync::{Arc, atomic::AtomicBool, atomic::Ordering};
use std::thread;
use std::time::SystemTime;

Expand All @@ -10,7 +10,7 @@ use graphics_server::{DrawStyle, PixelColor, Point, Rectangle, TextView};
use locales::t;
use num_traits::*;
use sntpc::{Error, NtpContext, NtpTimestampGenerator, NtpUdpSocket, Result};
use xous::{send_message, Message};
use xous::{Message, send_message};

use crate::VaultOp;

Expand Down Expand Up @@ -84,15 +84,11 @@ pub(crate) fn prereqs(sid: xous::SID, time_conn: xous::CID) -> ([u32; 4], bool)
if allow_redraw {
gam.draw_rectangle(
content,
Rectangle::new_with_style(
Point::new(0, 0),
screensize,
DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
},
),
Rectangle::new_with_style(Point::new(0, 0), screensize, DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
}),
)
.expect("can't clear content area");

Expand Down
2 changes: 1 addition & 1 deletion apps/vault/src/totp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
use hmac::{Hmac, Mac};
use num_traits::*;
use sha1::Sha1;
use xous::{send_message, Message};
use xous::{Message, send_message};

use crate::VaultMode;

Expand Down
85 changes: 33 additions & 52 deletions apps/vault/src/ux/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use locales::t;
use num_traits::*;
use pddb::Pddb;
use usb_device_xous::UsbDeviceType;
use vault::{utc_now, VaultOp};
use vault::{VaultOp, utc_now};

use crate::actions::ActionOp;
use crate::totp::{generate_totp_code, get_current_unix_time, TotpAlgorithm, TotpEntry};
use crate::totp::{TotpAlgorithm, TotpEntry, generate_totp_code, get_current_unix_time};
use crate::{ItemLists, SelectedEntry, VaultMode};

pub enum NavDir {
Expand Down Expand Up @@ -313,15 +313,11 @@ impl VaultUx {
self.gam
.draw_rectangle(
self.content,
Rectangle::new_with_style(
Point::new(0, 0),
self.screensize,
DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
},
),
Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
}),
)
.expect("can't clear content area");
self.title_dirty = true; // just blanked the whole area, have to redraw the title.
Expand Down Expand Up @@ -364,15 +360,11 @@ impl VaultUx {
self.gam
.draw_rectangle(
self.content,
Rectangle::new_with_style(
tl,
br,
DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
},
),
Rectangle::new_with_style(tl, br, DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
}),
)
.expect("can't clear content area");
// reset the search
Expand All @@ -387,15 +379,11 @@ impl VaultUx {
self.gam
.draw_rectangle(
self.content,
Rectangle::new_with_style(
tl,
self.screensize,
DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
},
),
Rectangle::new_with_style(tl, self.screensize, DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
}),
)
.expect("can't clear content area");
} else if dirty_tl.is_none() && dirty_br.is_none() {
Expand All @@ -405,15 +393,11 @@ impl VaultUx {
self.gam
.draw_rectangle(
self.content,
Rectangle::new_with_style(
Point::new(0, insert_at + 1),
self.screensize,
DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
},
),
Rectangle::new_with_style(Point::new(0, insert_at + 1), self.screensize, DrawStyle {
fill_color: Some(PixelColor::Light),
stroke_color: None,
stroke_width: 0,
}),
)
.expect("can't clear content area");
}
Expand Down Expand Up @@ -467,21 +451,18 @@ impl VaultUx {
let width = (self.screensize.x - (self.margin.x * 2)) as i32;
let delta_width = (delta * width * 100) / (30 * 100);
self.gam
.draw_rectangle(
self.content,
Rectangle {
tl: Point::new(self.margin.x, TITLE_HEIGHT - (BAR_HEIGHT + BAR_GAP)),
br: Point::new(
self.screensize.x - self.margin.x - delta_width as i16,
TITLE_HEIGHT - BAR_GAP,
),
style: DrawStyle {
fill_color: Some(PixelColor::Dark),
stroke_color: None,
stroke_width: 0,
},
.draw_rectangle(self.content, Rectangle {
tl: Point::new(self.margin.x, TITLE_HEIGHT - (BAR_HEIGHT + BAR_GAP)),
br: Point::new(
self.screensize.x - self.margin.x - delta_width as i16,
TITLE_HEIGHT - BAR_GAP,
),
style: DrawStyle {
fill_color: Some(PixelColor::Dark),
stroke_color: None,
stroke_width: 0,
},
)
})
.ok();
}
self.title_dirty = false;
Expand Down
2 changes: 1 addition & 1 deletion apps/vault/src/vendor_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::convert::TryFrom;

use cbor::reader::DecoderError;
use locales::t;
use vault::ctap::hid::{send::HidPacketIterator, ChannelID, CtapHidCommand, Message};
use vault::ctap::hid::{ChannelID, CtapHidCommand, Message, send::HidPacketIterator};
use vault::vault_api::{COMMAND_BACKUP_TOTP_CODES, COMMAND_RESET_SESSION, COMMAND_RESTORE_TOTP_CODES};

use crate::storage::{Error, PasswordRecord, TotpRecord};
Expand Down
2 changes: 1 addition & 1 deletion apps/vault/tools/vaultbackup-rs/src/authenticator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::str::FromStr;

use anyhow::{anyhow, bail, Result};
use anyhow::{Result, anyhow, bail};
use protobuf::Message;

include!(concat!(env!("OUT_DIR"), "/protos/mod.rs"));
Expand Down
4 changes: 2 additions & 2 deletions libs/chat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#![cfg_attr(target_os = "none", no_main)]

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

use api::*;
use num_traits::FromPrimitive;
use xous::{Error, CID, SID};
use xous::{CID, Error, SID};

pub fn main() -> ! {
let xns = xous_names::XousNames::new().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion libs/cramium-hal/src/ifram.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(feature = "std")]
use xous::Result;
use xous::{send_message, MemoryRange, Message};
use xous::{MemoryRange, Message, send_message};

pub enum IframBank {
Bank0,
Expand Down
4 changes: 2 additions & 2 deletions libs/cramium-hal/src/usb/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use core::convert::TryFrom;
use core::mem::size_of;
#[cfg(feature = "std")]
use core::sync::atomic::AtomicBool;
use core::sync::atomic::{compiler_fence, AtomicPtr, Ordering};
use core::sync::atomic::{AtomicPtr, Ordering, compiler_fence};
#[cfg(feature = "std")]
use std::sync::{Arc, Mutex};

use bitfield::bitfield;
#[cfg(feature = "std")]
use usb_device::bus::PollResult;
#[cfg(feature = "std")]
use usb_device::{class_prelude::*, Result, UsbDirection};
use usb_device::{Result, UsbDirection, class_prelude::*};
#[cfg(feature = "std")]
use utralib::generated::*;

Expand Down
2 changes: 1 addition & 1 deletion libs/flatipc-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::atomic::AtomicUsize;

use proc_macro::TokenStream;
use quote::{format_ident, quote};
use syn::{parse_macro_input, spanned::Spanned, DeriveInput};
use syn::{DeriveInput, parse_macro_input, spanned::Spanned};

fn ast_hash(ast: &syn::DeriveInput) -> usize {
use std::hash::{Hash, Hasher};
Expand Down
19 changes: 8 additions & 11 deletions libs/flatipc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@
//! Any object may be made into an IPC object provided it follows the following
//! requirements:
//!
//! - **The object is `#[repr(C)]`** - This is required to ensure the objecty
//! has a well-defined layout in memory. Other representations may shift
//! depending on optimizations.
//! - **The object only contains fields that are `IpcSafe`** - This trait is
//! implemented on primitive types that are able to be sent across an IPC
//! boundary. This includes all integers, floats, and booleans. It also
//! includes arrays of `IpcSafe` types, `Option<T>` where `T` is `IpcSafe`,
//! and `Result<T, E>` where `T` and `E` are `IpcSafe`. Pointers and
//! references are not `IpcSafe` and may not be used.
//! - **The object is `#[repr(C)]`** - This is required to ensure the objecty has a well-defined layout in
//! memory. Other representations may shift depending on optimizations.
//! - **The object only contains fields that are `IpcSafe`** - This trait is implemented on primitive types
//! that are able to be sent across an IPC boundary. This includes all integers, floats, and booleans. It
//! also includes arrays of `IpcSafe` types, `Option<T>` where `T` is `IpcSafe`, and `Result<T, E>` where
//! `T` and `E` are `IpcSafe`. Pointers and references are not `IpcSafe` and may not be used.
//!
//! When deriving `Ipc`, a new type will be created with the same name as
//! the original type prefixed with `Ipc`. For example, if you derive `Ipc`
Expand Down Expand Up @@ -120,8 +117,8 @@ extern crate self as flatipc;
pub use flatipc_derive::{Ipc, IpcSafe};
#[cfg(feature = "xous")]
mod backend {
pub use xous::Error;
pub use xous::CID;
pub use xous::Error;
}

#[cfg(not(feature = "xous"))]
Expand All @@ -135,7 +132,7 @@ mod backend {
}
}

pub use backend::{Error, CID};
pub use backend::{CID, Error};

pub mod string;
pub use string::String;
Expand Down
2 changes: 1 addition & 1 deletion libs/perflib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::num::{NonZeroU16, NonZeroU8};
use core::num::{NonZeroU8, NonZeroU16};
use std::cell::RefCell;

use utralib::generated::*;
Expand Down
4 changes: 2 additions & 2 deletions libs/tls/src/danger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::sync::Arc;

use locales::t;
use modals::Modals;
use rustls::client::danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier};
use rustls::client::WebPkiServerVerifier;
use rustls::crypto::{ring, verify_tls12_signature, verify_tls13_signature, WebPkiSupportedAlgorithms};
use rustls::client::danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier};
use rustls::crypto::{WebPkiSupportedAlgorithms, ring, verify_tls12_signature, verify_tls13_signature};
use rustls::pki_types::{CertificateDer, Der, ServerName, TrustAnchor, UnixTime};
use rustls::{CertificateError, DigitallySignedStruct, Error, RootCertStore, SignatureScheme};
use xous_names::XousNames;
Expand Down
4 changes: 2 additions & 2 deletions libs/userprefs/prefsgenerator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use proc_macro::{self, TokenStream};
use proc_macro2::Ident;
use proc_macro_error::{abort, proc_macro_error};
use proc_macro2::Ident;
use quote::{format_ident, quote};
use syn::{parse_macro_input, DeriveInput, FieldsNamed};
use syn::{DeriveInput, FieldsNamed, parse_macro_input};

#[proc_macro_error]
#[proc_macro_derive(GetterSetter)]
Expand Down
4 changes: 2 additions & 2 deletions loader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ use bootconfig::BootConfig;
use consts::*;
pub use loader::*;
use minielf::*;
use phase1::{phase_1, InitialProcess};
use phase2::{phase_2, ProgramDescription};
use phase1::{InitialProcess, phase_1};
use phase2::{ProgramDescription, phase_2};
#[cfg(feature = "swap")]
use platform::SwapHal;

Expand Down
Loading