2016-11-10 166 views
2

我想第一次運行clippy(我知道..我現在真的應該做到這一點了嗎?),我面臨一些錯誤。運行Clippy時排除依賴關係

我想要棉絨的項目取決於活塞,它編譯並運行成功。然而,當我跑大眼夾as described in the README

rustup run nightly cargo clippy 

它看起來像它開始試圖建立活塞和報告的錯誤是這樣的:

error[E0433]: failed to resolve. Use of undeclared type or module `gfx` 
    --> /Users/Simon/.cargo/registry/src/github.com- 1ecc6299db9ec823/piston2d-gfx_graphics-0.31.2/src/back_end.rs:31:10 
    | 
31 |  pos: gfx::VertexBuffer<PositionFormat>, 
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `gfx` 

error[E0433]: failed to resolve. Use of undeclared type or module  `gfx` 
    --> /Users/Simon/.cargo/registry/src/github.com- 1ecc6299db9ec823/piston2d-gfx_graphics-0.31.2/src/back_end.rs:32:12 
    | 
32 |  color: gfx::VertexBuffer<ColorFormat>, 
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `gfx` 

error[E0433]: failed to resolve. Use of undeclared type or module `gfx` 
    --> /Users/Simon/.cargo/registry/src/github.com-1ecc6299db9ec823/piston2d-gfx_graphics-0.31.2/src/back_end.rs:33:19 
    | 
33 |  blend_target: gfx::BlendTarget<gfx::format::Srgba8>, 
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `gfx` 

error[E0433]: failed to resolve. Use of undeclared type or module `gfx` 
    --> /Users/Simon/.cargo/registry/src/github.com-1ecc6299db9ec823/piston2d-gfx_graphics-0.31.2/src/back_end.rs:33:36 
    | 
33 |  blend_target: gfx::BlendTarget<gfx::format::Srgba8>, 
    |         ^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `gfx` 

error[E0433]: failed to resolve. Use of undeclared type or module `gfx` 
    --> /Users/Simon/.cargo/registry/src/github.com-1ecc6299db9ec823/piston2d-gfx_graphics-0.31.2/src/back_end.rs:34:21 
    | 
34 |  stencil_target: gfx::StencilTarget<gfx::format::DepthStencil>, 
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use of undeclared type or module `gfx` 

我怎樣才能知道大眼夾不建立活塞和/或棉絨它?我怎樣才能建立我的項目和皮特我的代碼?

cargo build從同一文件夾成功建立項目。

我還沒有深入研究clippy的代碼,但我認爲它已經關閉了AST,並沒有真正構建二進制文件......看起來我錯了嗎?

+2

謝謝@Shepmaster我不知道<! - language: - >標記。我學到了東西! –

+0

太糟糕了,我真的不能幫助真正的問題:-) – Shepmaster

回答

3

我該如何告訴clippy不要製造活塞和/或皮棉呢?

你不行。

Clippy需要建立所有的依賴關係才能幹掉你的項目。這是因爲只有少量棉布在AST上運行。大部分棉絨都在HIR上運行,並且還需要類型信息。

不幸的是,我不能在piston_window v0.57.0上重現您的錯誤,但該版本拉到piston2d-gfx_graphics v0.33.1,這比您使用的0.31.2更新。也許更新會解決你的問題。

+0

謝謝。我其實從來沒有想過要檢查更新。我轉換爲所有活塞箱版本的星號,並運行「貨物更新」,並且......你難道不知道它......每天晚上運行的貨物clippy'現在正在返回實際的clippy結果。謝謝你的提示! –