How to exclude the Rust std env when play substrate code in IDE

Viewed 126

I use the JetBrains IDE with a Rust plugin to run the code of Substrate.

The Substrate project usually has a line on top of a file:

#![cfg_attr(not(feature = "std"), no_std)]

However, this line is gray, now bright yellow, this line is not activated, the cfg attribute is not using now. which means the development env is still in Rust std env, I guess.

Substrate doesn't use the Rust std lib. So, I wondering is it possible to config the IDE to activate the substrate std env, but not the Rust std. This maybe useful for beginner not to include some incorrect func or lib.

1 Answers

Substrate doesn't use the Rust std lib.

This is not right, we just use the normal std when compiling for native. Aka when you compile the node. However, when we compile for wasm we disable std and use no_std.

As we have std enabled always by default, the IDE will almost never have no_std activated. So, I would just ignore this "warning".

Related