1 个不稳定版本
0.1.0 | 2020年10月13日 |
---|
#284 在 值格式化
15KB
265 行
trait-bound-pretty
有时,rust 会给你一些这样的错误
error[E0277]: the trait bound `Arc<sc_service::client::Client<sc_client_db::Backend<sp_runtime::generic::Block<sp_runtime::generic::Header<u32, BlakeTwo256>, OpaqueExtrinsic>>, LocalCallExecutor<sc_client_db::Backend<sp_runtime::generic::Block<sp_runtime::generic::Header<u32, BlakeTwo256>, OpaqueExtrinsic>>, NativeExecutor<Executor>>, sp_runtime::generic::Block<sp_runtime::generic::Header<u32, BlakeTwo256>, OpaqueExtrinsic>, RuntimeApi>>: HeaderBackend<sp_runtime::generic::Block<sp_runtime::generic::Header<u32, BlakeTwo256>, OpaqueExtrinsic>>` is not satisfied
这对人类来说很难阅读。如果我们将其展开成树状结构,就会容易一些
error[E0277]: the item:
Arc<
sc_service::client::Client<
sc_client_db::Backend<
sp_runtime::generic::Block<
sp_runtime::generic::Header<
u32,
BlakeTwo256
>,
OpaqueExtrinsic
>
>,
LocalCallExecutor<
sc_client_db::Backend<
sp_runtime::generic::Block<
sp_runtime::generic::Header<
u32,
BlakeTwo256
>,
OpaqueExtrinsic
>
>,
NativeExecutor<
Executor
>
>,
sp_runtime::generic::Block<
sp_runtime::generic::Header<
u32,
BlakeTwo256
>,
OpaqueExtrinsic
>,
RuntimeApi
>
>
does not satisfy the trait bound:
HeaderBackend<
sp_runtime::generic::Block<
sp_runtime::generic::Header<
u32,
BlakeTwo256
>,
OpaqueExtrinsic
>
>
这就是它所做的事情。
用法
此可执行文件是一个以行为导向的流编辑器,这意味着你可以直接通过它传递数据。如果它看到可以解析为 E0277 或类型名称的行,它将美化打印它。否则,它将保持数据不变。
示例:检查当前项目,展开 E0277
cargo check 2> >(trait-bound-pretty)
用法文档
USAGE:
trait-bound-pretty [FLAGS]
FLAGS:
-b, --bare-item
Attempt to parse and print bare items instead of E0277 lines
-f, --fail-fast
If any parse error is produced, abort instead of continuing at the next line
-h, --help
Prints help information
-s, --strict
Activate strict mode
Normally, any line of input which can't be parsed is passed through unchanged. In strict mode, any line of
input which can't be parsed as an E0277 or a Rust type produces an error.
-V, --version
Prints version information
依赖关系
~4.5–7.5MB
~123K SLoC