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

rustfmt: reformat repository according to latest rules #577

Closed
wants to merge 1 commit into from
Closed
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/mtxchat/src/listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use url::Url;
use xous::CID;
use xous_ipc::Buffer;

use crate::{get_username, web, MTX_LONG_TIMEOUT_MS};
use crate::{MTX_LONG_TIMEOUT_MS, get_username, web};

pub fn listen(
url: &mut Url,
Expand Down
2 changes: 1 addition & 1 deletion apps/mtxcli/src/cmds/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::fmt::Write;

use xous_ipc::String as XousString;

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/mtxcli/src/mtxcli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ impl Mtxcli {
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/repl/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ impl Repl {
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/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
10 changes: 5 additions & 5 deletions apps/vault/src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::cell::RefCell;
use std::io::ErrorKind;
use std::io::{Read, Write};
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
atomic::{AtomicBool, Ordering},
};

use gam::TextEntryPayload;
Expand All @@ -17,15 +17,15 @@ use perflib::*;
use persistent_store::store::OPENSK2_DICT;
use vault::env::xous::U2F_APP_DICT;
use vault::{
atime_to_str, basis_change, ctap::data_formats::PublicKeyCredentialSource, deserialize_app_info,
serialize_app_info, utc_now, AppInfo, VAULT_ALLOC_HINT, VAULT_PASSWORD_DICT, VAULT_TOTP_DICT,
AppInfo, VAULT_ALLOC_HINT, VAULT_PASSWORD_DICT, VAULT_TOTP_DICT, atime_to_str, basis_change,
ctap::data_formats::PublicKeyCredentialSource, deserialize_app_info, serialize_app_info, utc_now,
};
use xous::{send_message, Message};
use xous::{Message, send_message};

use crate::storage::{self, PasswordRecord, StorageContent};
use crate::totp::TotpAlgorithm;
use crate::{storage::TotpRecord, ListItem, ListKey};
use crate::{ItemLists, SelectedEntry, VaultMode};
use crate::{ListItem, ListKey, storage::TotpRecord};
#[cfg(feature = "vaultperf")]
const FILE_ID_APPS_VAULT_SRC_ACTIONS: u32 = 1;

Expand Down
8 changes: 4 additions & 4 deletions apps/vault/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ use actions::ActionOp;
use itemcache::*;
use locales::t;
use num_traits::*;
use ux::framework::{name_to_style, VaultUx, DEFAULT_FONT, FONT_LIST};
use ux::framework::{DEFAULT_FONT, FONT_LIST, VaultUx, name_to_style};
use vault::ctap::main_hid::HidIterType;
use vault::env::xous::XousEnv;
use vault::env::Env;
use vault::{Transport, VaultOp, SELF_CONN};
use xous::{msg_blocking_scalar_unpack, msg_scalar_unpack, send_message, Message};
use vault::env::xous::XousEnv;
use vault::{SELF_CONN, Transport, VaultOp};
use xous::{Message, msg_blocking_scalar_unpack, msg_scalar_unpack, send_message};
use xous_ipc::Buffer;
use xous_usb_hid::device::fido::*;

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
6 changes: 3 additions & 3 deletions kernel/src/arch/arm/irq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
use core::arch::asm;
use core::convert::TryInto;

use xous_kernel::{arch::Arguments, PID, TID};
use xous_kernel::{PID, TID, arch::Arguments};

use crate::arch::process::{current_pid, EXIT_THREAD, RETURN_FROM_EXCEPTION_HANDLER, RETURN_FROM_ISR};
use crate::services::{ArchProcess, Thread};
use crate::SystemServices;
use crate::arch::process::{EXIT_THREAD, RETURN_FROM_EXCEPTION_HANDLER, RETURN_FROM_ISR, current_pid};
use crate::services::{ArchProcess, Thread};

extern "Rust" {
fn _xous_syscall_return_result(context: &Thread) -> !;
Expand Down
8 changes: 4 additions & 4 deletions kernel/src/arch/arm/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
use core::num::NonZeroU8;

pub use armv7::structures::paging::{
InMemoryRegister, PageTable as L2PageTable, PageTableDescriptor, PageTableMemory, PageTableType,
Readable, TranslationTable, TranslationTableDescriptor, TranslationTableMemory, TranslationTableType,
Writeable, PAGE_TABLE_FLAGS, PAGE_TABLE_SIZE, SMALL_PAGE_FLAGS,
InMemoryRegister, PAGE_TABLE_FLAGS, PAGE_TABLE_SIZE, PageTable as L2PageTable, PageTableDescriptor,
PageTableMemory, PageTableType, Readable, SMALL_PAGE_FLAGS, TranslationTable, TranslationTableDescriptor,
TranslationTableMemory, TranslationTableType, Writeable,
};
pub use armv7::{PhysicalAddress, VirtualAddress};
use xous_kernel::{MemoryFlags, PID};

use crate::SystemServices;
use crate::arch::arm::process::InitialProcess;
use crate::mem::MemoryManager;
use crate::SystemServices;

pub const DEFAULT_HEAP_BASE: usize = 0x3000_0000;
pub const DEFAULT_MESSAGE_BASE: usize = 0x4000_0000;
Expand Down
Loading