diff --git a/src/api_server/src/lib.rs b/src/api_server/src/lib.rs index 6dc458dd199..a4a5f0eec7d 100644 --- a/src/api_server/src/lib.rs +++ b/src/api_server/src/lib.rs @@ -109,16 +109,16 @@ impl ApiServer { /// # Example /// /// ``` - /// use mmds::MAX_DATA_STORE_SIZE; /// use api_server::ApiServer; + /// use logger::ProcessTimeReporter; + /// use mmds::MAX_DATA_STORE_SIZE; /// use mmds::MMDS; + /// use std::env::consts::ARCH; /// use std::{ /// convert::TryInto, io::Read, io::Write, os::unix::net::UnixStream, path::PathBuf, /// sync::mpsc::channel, thread, time::Duration, /// }; - /// use std::env::consts::ARCH; /// use utils::{eventfd::EventFd, tempfile::TempFile}; - /// use logger::ProcessTimeReporter; /// use vmm::rpc_interface::VmmData; /// use vmm::seccomp_filters::{get_filters, SeccompConfig}; /// use vmm::vmm_config::instance_info::InstanceInfo; diff --git a/src/cpuid/src/bit_helper.rs b/src/cpuid/src/bit_helper.rs index 3ea8a3560f5..0b8b8d43930 100644 --- a/src/cpuid/src/bit_helper.rs +++ b/src/cpuid/src/bit_helper.rs @@ -44,8 +44,8 @@ pub trait BitRangeExt { /// use cpuid::bit_helper::*; /// /// let range = BitRange { - /// msb_index: 7, - /// lsb_index: 3, + /// msb_index: 7, + /// lsb_index: 3, /// }; /// println!("binary value: {:b}", range.get_mask()); /// ``` diff --git a/src/logger/src/logger.rs b/src/logger/src/logger.rs index 7fdb27ae5f1..4a72a2e125a 100644 --- a/src/logger/src/logger.rs +++ b/src/logger/src/logger.rs @@ -20,7 +20,7 @@ //! ## Example for logging to stdout/stderr //! //! ``` -//! use logger::{warn, error, LOGGER}; +//! use logger::{error, warn, LOGGER}; //! use std::ops::Deref; //! //! // Optionally do an initial configuration for the logger. @@ -35,17 +35,14 @@ //! //! ``` //! use libc::c_char; +//! use logger::{error, warn, LOGGER}; //! use std::io::Cursor; -//! use logger::{warn, error, LOGGER}; //! //! let mut logs = Cursor::new(vec![0; 15]); //! //! // Initialize the logger to log to a FIFO that was created beforehand. //! assert!(LOGGER -//! .init( -//! "Running Firecracker v.x".to_string(), -//! Box::new(logs), -//! ) +//! .init("Running Firecracker v.x".to_string(), Box::new(logs),) //! .is_ok()); //! // The following messages should appear in the in-memory buffer `logs`. //! warn!("this is a warning"); @@ -305,9 +302,9 @@ impl Logger { /// use std::ops::Deref; /// /// LOGGER - /// .deref() - /// .configure(Some("MY-INSTANCE".to_string())) - /// .unwrap(); + /// .deref() + /// .configure(Some("MY-INSTANCE".to_string())) + /// .unwrap(); /// ``` pub fn configure(&self, instance_id: Option) -> Result<()> { self.init @@ -341,10 +338,7 @@ impl Logger { /// /// let mut logs = Cursor::new(vec![0; 15]); /// - /// LOGGER.init( - /// "Running Firecracker v.x".to_string(), - /// Box::new(logs), - /// ); + /// LOGGER.init("Running Firecracker v.x".to_string(), Box::new(logs)); /// ``` pub fn init(&self, header: String, log_dest: Box) -> Result<()> { self.init diff --git a/src/mmds/src/data_store.rs b/src/mmds/src/data_store.rs index 913dd4c8662..f61899f2698 100644 --- a/src/mmds/src/data_store.rs +++ b/src/mmds/src/data_store.rs @@ -226,7 +226,7 @@ impl Mmds { /// "key2" : "value3" /// "key3" : "value3" /// } - ///``` + /// ``` /// /// IMDS formatted JSON object: /// ```text diff --git a/src/net_gen/src/iff.rs b/src/net_gen/src/iff.rs index 1448251d7c4..01175c5e476 100644 --- a/src/net_gen/src/iff.rs +++ b/src/net_gen/src/iff.rs @@ -2727,45 +2727,45 @@ pub const net_device_flags_IFF_PORTSEL: net_device_flags = 8192; pub const net_device_flags_IFF_AUTOMEDIA: net_device_flags = 16384; pub const net_device_flags_IFF_DYNAMIC: net_device_flags = 32768; /** - ** enum net_device_flags - &struct net_device flags - ** - ** These are the &struct net_device flags, they can be set by drivers, the - ** kernel and some can be triggered by userspace. Userspace can query and - ** set these flags using userspace utilities but there is also a sysfs - ** entry available for all dev flags which can be queried and set. These flags - ** are shared for all types of net_devices. The sysfs entries are available - ** via /sys/class/net//flags. Flags which can be toggled through sysfs - ** are annotated below, note that only a few flags can be toggled and some - ** other flags are always preserved from the original net_device flags - ** even if you try to set them via sysfs. Flags which are always preserved - ** are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__ - ** are annotated below as such. - ** - ** You should have a pretty good reason to be extending these flags. - ** - ** @IFF_UP: interface is up. Can be toggled through sysfs. - ** @IFF_BROADCAST: broadcast address valid. Volatile. - ** @IFF_DEBUG: turn on debugging. Can be toggled through sysfs. - ** @IFF_LOOPBACK: is a loopback net. Volatile. - ** @IFF_POINTOPOINT: interface is has p-p link. Volatile. - ** @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs. - ** Volatile. - ** @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile. - ** @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile. - ** @IFF_PROMISC: receive all packets. Can be toggled through sysfs. - ** @IFF_ALLMULTI: receive all multicast packets. Can be toggled through - ** sysfs. - ** @IFF_MASTER: master of a load balancer. Volatile. - ** @IFF_SLAVE: slave of a load balancer. Volatile. - ** @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs. - ** @IFF_PORTSEL: can set media type. Can be toggled through sysfs. - ** @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs. - ** @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled - ** through sysfs. - ** @IFF_LOWER_UP: driver signals L1 up. Volatile. - ** @IFF_DORMANT: driver signals dormant. Volatile. - ** @IFF_ECHO: echo sent packets. Volatile. - **/ + * enum net_device_flags - &struct net_device flags + * + * These are the &struct net_device flags, they can be set by drivers, the + * kernel and some can be triggered by userspace. Userspace can query and + * set these flags using userspace utilities but there is also a sysfs + * entry available for all dev flags which can be queried and set. These flags + * are shared for all types of net_devices. The sysfs entries are available + * via /sys/class/net//flags. Flags which can be toggled through sysfs + * are annotated below, note that only a few flags can be toggled and some + * other flags are always preserved from the original net_device flags + * even if you try to set them via sysfs. Flags which are always preserved + * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__ + * are annotated below as such. + * + * You should have a pretty good reason to be extending these flags. + * + * @IFF_UP: interface is up. Can be toggled through sysfs. + * @IFF_BROADCAST: broadcast address valid. Volatile. + * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs. + * @IFF_LOOPBACK: is a loopback net. Volatile. + * @IFF_POINTOPOINT: interface is has p-p link. Volatile. + * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs. + * Volatile. + * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile. + * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile. + * @IFF_PROMISC: receive all packets. Can be toggled through sysfs. + * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through + * sysfs. + * @IFF_MASTER: master of a load balancer. Volatile. + * @IFF_SLAVE: slave of a load balancer. Volatile. + * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs. + * @IFF_PORTSEL: can set media type. Can be toggled through sysfs. + * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs. + * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled + * through sysfs. + * @IFF_LOWER_UP: driver signals L1 up. Volatile. + * @IFF_DORMANT: driver signals dormant. Volatile. + * @IFF_ECHO: echo sent packets. Volatile. + */ pub type net_device_flags = ::std::os::raw::c_uint; pub const IF_OPER_UNKNOWN: _bindgen_ty_4 = 0; pub const IF_OPER_NOTPRESENT: _bindgen_ty_4 = 1; diff --git a/src/snapshot/src/lib.rs b/src/snapshot/src/lib.rs index 2415e59f14a..836a488344f 100644 --- a/src/snapshot/src/lib.rs +++ b/src/snapshot/src/lib.rs @@ -24,7 +24,6 @@ //! primitives types (currently we use versionize that uses serde bincode as a backend). The current //! implementation does not have any logic dependent on it. //! - **the data version** which refers to the state. -//! mod persist; pub use crate::persist::Persist; diff --git a/src/utils/src/net/ipv4addr.rs b/src/utils/src/net/ipv4addr.rs index cbf64933595..d2ad99f6b5a 100644 --- a/src/utils/src/net/ipv4addr.rs +++ b/src/utils/src/net/ipv4addr.rs @@ -11,7 +11,6 @@ use std::net::Ipv4Addr; /// use utils::net::ipv4addr::is_link_local_valid; /// /// is_link_local_valid(Ipv4Addr::new(169, 254, 1, 1)); -/// pub fn is_link_local_valid(ipv4_addr: Ipv4Addr) -> bool { match ipv4_addr.octets() { [169, 254, 0, _] => false, diff --git a/src/utils/src/sm.rs b/src/utils/src/sm.rs index 25918809267..e8535f17d78 100644 --- a/src/utils/src/sm.rs +++ b/src/utils/src/sm.rs @@ -24,7 +24,6 @@ impl StateMachine { /// # Arguments /// /// `function` - the state handler for this state. - /// pub fn new(function: Option>) -> StateMachine { StateMachine { function } } @@ -34,7 +33,6 @@ impl StateMachine { /// # Arguments /// /// `function` - the state handler for this state. - /// pub fn next(function: StateFn) -> StateMachine { StateMachine::new(Some(function)) } @@ -45,7 +43,6 @@ impl StateMachine { /// # Arguments /// /// `function` - the state handler for this last state. - /// pub fn finish() -> StateMachine { StateMachine::new(None) } @@ -57,7 +54,6 @@ impl StateMachine { /// `machine` - a mutable reference to the object running through the various states. /// `starting_state_fn` - a `fn(&mut T) -> StateMachine` that should be the handler for /// the initial state. - /// pub fn run(machine: &mut T, starting_state_fn: StateFn) { // Start off in the `starting_state` state. let mut state_machine = StateMachine::new(Some(starting_state_fn)); diff --git a/tests/integration_tests/style/test_rust.py b/tests/integration_tests/style/test_rust.py index 6f87f6bc5dc..cb6de43adb0 100644 --- a/tests/integration_tests/style/test_rust.py +++ b/tests/integration_tests/style/test_rust.py @@ -13,7 +13,8 @@ def test_rust_style(): """ # Check that the output is empty. _, stdout, _ = utils.run_cmd( - 'cargo fmt --all -- --check') + 'cargo fmt --all -- --check ' + '--config format_code_in_doc_comments=true') # rustfmt prepends `"Diff in"` to the reported output. assert "Diff in" not in stdout