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

alloc: clean and ensure no_global_oom_handling builds are warning-free #98652

Merged
merged 2 commits into from
Jun 29, 2022

Commits on Jun 29, 2022

  1. alloc: fix no_global_oom_handling warnings

    Rust 1.62.0 introduced a couple new `unused_imports` warnings
    in `no_global_oom_handling` builds, making a total of 5 warnings:
    
    ```txt
    warning: unused import: `Unsize`
     --> library/alloc/src/boxed/thin.rs:6:33
      |
    6 | use core::marker::{PhantomData, Unsize};
      |                                 ^^^^^^
      |
      = note: `#[warn(unused_imports)]` on by default
    
    warning: unused import: `from_fn`
      --> library/alloc/src/string.rs:51:18
       |
    51 | use core::iter::{from_fn, FusedIterator};
       |                  ^^^^^^^
    
    warning: unused import: `core::ops::Deref`
      --> library/alloc/src/vec/into_iter.rs:12:5
       |
    12 | use core::ops::Deref;
       |     ^^^^^^^^^^^^^^^^
    
    warning: associated function `shrink` is never used
       --> library/alloc/src/raw_vec.rs:424:8
        |
    424 |     fn shrink(&mut self, cap: usize) -> Result<(), TryReserveError> {
        |        ^^^^^^
        |
        = note: `#[warn(dead_code)]` on by default
    
    warning: associated function `forget_remaining_elements` is never used
       --> library/alloc/src/vec/into_iter.rs:126:19
        |
    126 |     pub(crate) fn forget_remaining_elements(&mut self) {
        |                   ^^^^^^^^^^^^^^^^^^^^^^^^^
    ```
    
    This patch cleans them so that projects compiling `alloc` without
    infallible allocations do not see the warnings. It also enables
    the use of `-Dwarnings`.
    
    The couple `dead_code` ones may be reverted when some fallible
    allocation support starts using them.
    
    Signed-off-by: Miguel Ojeda <[email protected]>
    ojeda committed Jun 29, 2022
    Configuration menu
    Copy the full SHA
    83addf2 View commit details
    Browse the repository at this point in the history
  2. alloc: ensure no_global_oom_handling builds are warning-free

    Rust 1.62.0 introduced a couple new `unused_imports` warnings
    in `no_global_oom_handling` builds, making a total of 5 warnings.
    
    To avoid accumulating more over time, let's keep the builds
    warning-free. This ensures projects compiling `alloc` without
    infallible allocations do not see the warnings in the future
    and that they can keep enabling `-Dwarnings`.
    
    Signed-off-by: Miguel Ojeda <[email protected]>
    ojeda committed Jun 29, 2022
    Configuration menu
    Copy the full SHA
    60dc54e View commit details
    Browse the repository at this point in the history