Is it safe to do only `cargo test` in my travis jobs?

It is not safe to do cargo test only. You want to keep it as cargo build && cargo test.

As @kornel wrote, it is possible for cargo test to work but break cargo build as in the following minimal example.

#[cfg(test)]
struct A;

type B = A;
6 Likes