enforces Module imports granularity (#445)

This commit is contained in:
kaczmarczyck
2022-03-14 20:44:48 +01:00
committed by GitHub
parent ba0c583617
commit 7e7d5e38a1
12 changed files with 22 additions and 37 deletions

View File

@@ -15,10 +15,8 @@
use super::bitfields::{
Busy, CryptoMode, HashControl, Interrupts, LliWord1, PaddingConfig, RgfEndianness, Task,
};
use tock_registers::{
register_structs,
registers::{ReadOnly, ReadWrite, WriteOnly},
};
use tock_registers::register_structs;
use tock_registers::registers::{ReadOnly, ReadWrite, WriteOnly};
register_structs! {
pub CryptoCellControlRegisters {

View File

@@ -14,16 +14,12 @@
extern crate alloc;
use openssl::bn;
use openssl::ec;
use openssl::nid;
use openssl::{bn, ec, nid};
use sk_cbor::cbor_map;
use std::env;
use std::fs;
use std::fs::File;
use std::io::Read;
use std::io::Write;
use std::io::{Read, Write};
use std::path::Path;
use std::{env, fs};
use uuid::Uuid;
fn main() {

View File

@@ -24,8 +24,7 @@ use crypto::{aes256, cbc, ecdsa, rng256, sha256, Hash256};
use libtock_drivers::console::Console;
use libtock_drivers::result::FlexUnwrap;
use libtock_drivers::timer;
use libtock_drivers::timer::Timer;
use libtock_drivers::timer::Timestamp;
use libtock_drivers::timer::{Timer, Timestamp};
libtock_core::stack_size! {0x800}

View File

@@ -11,8 +11,7 @@ libtock_core::stack_size! {0x4000}
#[cfg(not(feature = "with_nfc"))]
mod example {
use super::Console;
use super::Write;
use super::{Console, Write};
pub fn nfc(console: &mut Console) {
writeln!(console, "NFC feature flag is missing!").unwrap();
@@ -21,16 +20,12 @@ mod example {
#[cfg(feature = "with_nfc")]
mod example {
use super::Console;
use super::Write;
use super::{Console, Write};
use libtock_core::result::CommandError;
use libtock_drivers::nfc::NfcTag;
use libtock_drivers::nfc::RecvOp;
use libtock_drivers::result::FlexUnwrap;
use libtock_drivers::result::TockError;
use libtock_drivers::nfc::{NfcTag, RecvOp};
use libtock_drivers::result::{FlexUnwrap, TockError};
use libtock_drivers::timer;
use libtock_drivers::timer::Timer;
use libtock_drivers::timer::Timestamp;
use libtock_drivers::timer::{Timer, Timestamp};
#[derive(Copy, Clone, Debug, PartialEq)]
#[allow(clippy::upper_case_acronyms)]

View File

@@ -363,7 +363,9 @@ macro_rules! cbor_bytes_lit {
#[cfg(test)]
mod test {
use super::super::values::{SimpleValue, Value};
use alloc::{string::String, vec, vec::Vec};
use alloc::string::String;
use alloc::vec;
use alloc::vec::Vec;
#[test]
fn test_cbor_simple_values() {

View File

@@ -1,3 +1,4 @@
use_field_init_shorthand = true
use_try_shorthand = true
edition = "2018"
edition = "2018"
imports_granularity = "Module"

View File

@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use super::cbor_read;
use super::customization::{MAX_CREDENTIAL_COUNT_IN_LIST, MAX_LARGE_BLOB_ARRAY_SIZE};
use super::data_formats::{
extract_array, extract_bool, extract_byte_string, extract_map, extract_text_string,
@@ -23,8 +22,8 @@ use super::data_formats::{
PublicKeyCredentialDescriptor, PublicKeyCredentialParameter, PublicKeyCredentialRpEntity,
PublicKeyCredentialUserEntity, SetMinPinLengthParams,
};
use super::key_material;
use super::status_code::Ctap2StatusCode;
use super::{cbor_read, key_material};
use alloc::string::String;
use alloc::vec::Vec;
use arrayref::array_ref;

View File

@@ -19,8 +19,7 @@ use crate::ctap::storage;
use crate::env::Env;
use alloc::vec::Vec;
use arrayref::array_ref;
use core::convert::Into;
use core::convert::TryFrom;
use core::convert::{Into, TryFrom};
// For now, they're the same thing with apdu.rs containing the authoritative definition
pub type Ctap1StatusCode = ApduStatusCode;

View File

@@ -75,11 +75,10 @@ use alloc::vec::Vec;
use arrayref::array_ref;
use byteorder::{BigEndian, ByteOrder};
use core::convert::TryFrom;
use crypto::ecdsa;
use crypto::hmac::{hmac_256, verify_hmac_256};
use crypto::rng256::Rng256;
use crypto::sha256::Sha256;
use crypto::Hash256;
use crypto::{ecdsa, Hash256};
use embedded_time::duration::Milliseconds;
use sk_cbor as cbor;
use sk_cbor::cbor_map_options;

View File

@@ -23,9 +23,8 @@ use crate::ctap::data_formats::{
extract_array, extract_text_string, CredentialProtectionPolicy, PublicKeyCredentialSource,
PublicKeyCredentialUserEntity,
};
use crate::ctap::key_material;
use crate::ctap::status_code::Ctap2StatusCode;
use crate::ctap::INITIAL_SIGNATURE_COUNTER;
use crate::ctap::{key_material, INITIAL_SIGNATURE_COUNTER};
use crate::env::Env;
use alloc::string::String;
use alloc::vec;

View File

@@ -1,6 +1,5 @@
use crate::util;
use core::alloc::GlobalAlloc;
use core::alloc::Layout;
use core::alloc::{GlobalAlloc, Layout};
#[cfg(any(feature = "debug_allocations", feature = "panic_console"))]
use core::fmt::Write;
use core::ptr;

View File

@@ -15,9 +15,8 @@
#[cfg(feature = "debug_ctap")]
use crate::console::Console;
use crate::result::TockError;
use crate::timer;
use crate::timer::Duration;
use crate::util;
use crate::{timer, util};
use core::cell::Cell;
#[cfg(feature = "debug_ctap")]
use core::fmt::Write;