0
我在/src/lib.rs
了這個箱子,我正在嘗試運行測試:測試定製的箱子
#![crate_type = "lib"]
#![crate_name = "mycrate"]
pub mod mycrate {
pub struct Struct {
field: i32,
}
impl Struct {
pub fn new(n: i32) -> Struct {
Struct { field: n }
}
}
}
在/tests/test.rs
測試文件:
extern crate mycrate;
use mycrate::*;
#[test]
fn test() {
...
}
運行cargo test
給出了這樣的錯誤:
tests/test.rs:3:5: 3:16 error: import `mycrate` conflicts with imported crate in this module (maybe you meant `use mycrate::*`?) [E0254]
tests/test.rs:3 use mycrate::*;
^~~~~~~~~
我在做什麼錯在這裏?