about import warning
V version: latest:V 0.1.25 5a6f4aa OS: mac
What did you do? in my module,when I import time module,I just want to use the C function defined
pub struct C.timeval {
tv_sec u64
tv_usec u64
}
I do not use any other function or struct in time module
What did you expect to see? the code can run without a warning. I think one module just only use the C function defined in the other module,It can also be treated as use the module
What did you see instead? the V compiler give me a warning:the following imports were never used: time so I have to redefine C.timeval struct in my own module
tiny replication:
module main
pub struct C.aa {
a u64
}
pub fn main() {}
just use:
import time as _
to avoid th warning.
looks like v does not see the c struct as belonging to time anyway as you can use it without the time. prefix.
$ v run x.v
x.v:3:8: warning: module 'time' is imported but never used. Use `import time as _`, to silence this warning, or just remove the unused import line
1 | module main
2 |
3 | import time
| ~~~~
4 |
5 | fn main() {
C.timeval{
tv_sec: 0
tv_usec: 0
}