1
0
mirror of https://github.com/bspeice/qadapt synced 2024-11-21 13:28:11 -05:00

Actually run rustfmt

This commit is contained in:
Bradlee Speice 2018-12-06 23:19:37 -05:00
parent 1832cfb389
commit 508aa05cb9
2 changed files with 11 additions and 12 deletions

View File

@ -5,41 +5,41 @@
//! or code inside an `assert_no_alloc!` macro interacts with the allocator in any way. //! or code inside an `assert_no_alloc!` macro interacts with the allocator in any way.
//! Wanton allocations and unforeseen drops no more - this library lets you focus on //! Wanton allocations and unforeseen drops no more - this library lets you focus on
//! writing code without worrying if Rust properly managed to inline the variable into the stack. //! writing code without worrying if Rust properly managed to inline the variable into the stack.
//! //!
//! Now, an allocator blowing up in production is a scary thought; that's why QADAPT //! Now, an allocator blowing up in production is a scary thought; that's why QADAPT
//! is designed to strip its own code out whenever you're running with a release build. //! is designed to strip its own code out whenever you're running with a release build.
//! Just like the [`debug_assert!` macro](https://doc.rust-lang.org/std/macro.debug_assert.html) //! Just like the [`debug_assert!` macro](https://doc.rust-lang.org/std/macro.debug_assert.html)
//! in Rust's standard library, it's safe to use without worrying about a unforeseen //! in Rust's standard library, it's safe to use without worrying about a unforeseen
//! circumstance causing your application to crash. //! circumstance causing your application to crash.
//! //!
//! # Usage //! # Usage
//! //!
//! Actually making use of QADAPT is straight-forward. To set up the allocator, //! Actually making use of QADAPT is straight-forward. To set up the allocator,
//! place the following snippet in either your program binaries (main.rs) or tests: //! place the following snippet in either your program binaries (main.rs) or tests:
//! //!
//! ```rust,ignore //! ```rust,ignore
//! use qadapt::QADAPT; //! use qadapt::QADAPT;
//! //!
//! #[global_allocator] //! #[global_allocator]
//! static Q: QADAPT = QADAPT; //! static Q: QADAPT = QADAPT;
//! ``` //! ```
//! //!
//! After that, there are two ways of telling QADAPT that it should trigger a panic: //! After that, there are two ways of telling QADAPT that it should trigger a panic:
//! //!
//! 1. Annotate functions with the `#[no_alloc]` proc macro: //! 1. Annotate functions with the `#[no_alloc]` proc macro:
//! ```rust,no_run //! ```rust,no_run
//! use qadapt::no_alloc; //! use qadapt::no_alloc;
//! //!
//! #[no_alloc] //! #[no_alloc]
//! fn do_math() -> u8 { //! fn do_math() -> u8 {
//! 2 + 2 //! 2 + 2
//! } //! }
//! ``` //! ```
//! //!
//! 2. Evaluate expressions with the `assert_no_alloc!` macro //! 2. Evaluate expressions with the `assert_no_alloc!` macro
//! ```rust,no_run //! ```rust,no_run
//! use qadapt::assert_no_alloc; //! use qadapt::assert_no_alloc;
//! //!
//! fn do_work() { //! fn do_work() {
//! // This code is allowed to trigger an allocation //! // This code is allowed to trigger an allocation
//! let b = Box::new(8); //! let b = Box::new(8);
@ -119,7 +119,7 @@ pub fn exit_protected() {
/// Get the result of an expression, guaranteeing that no memory accesses occur /// Get the result of an expression, guaranteeing that no memory accesses occur
/// during its evaluation. /// during its evaluation.
/// ///
/// **Warning**: Unexpected behavior may occur when using the `return` keyword. /// **Warning**: Unexpected behavior may occur when using the `return` keyword.
/// Because the macro cleanup logic will not be run, QADAPT may trigger a panic /// Because the macro cleanup logic will not be run, QADAPT may trigger a panic
/// in code that was not specifically intended to be allocation-free. /// in code that was not specifically intended to be allocation-free.

View File

@ -28,4 +28,3 @@ fn early_return_boxing() {
panic!("Intentional") panic!("Intentional")
} }
} }