RS.CLIPPY.STD_INSTEAD_OF_ALLOC

Type is imported from std when available in alloc

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: std_instead_of_alloc. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Finds items imported through std when available through alloc.

Why restrict this?

Crates which have no_std compatibility and require alloc may wish to ensure types are imported from alloc to ensure disabling std does not cause the crate to fail to compile. This lint is also useful for crates migrating to become no_std compatible.

Example

use std::vec::Vec;

Use instead:

use alloc::vec::Vec;