std::vec::Vec also implements the
Clone trait, so a
Vec can be copied with
::clone(). Why does it also provide
Generally, I would expect common trait methods for common functionality to be preferred over harder-to-remember per-type method names.
If this were some pre-
Clone legacy method, I'd expect it to be marked deprecated. But it does not appear to be marked so.
rustc 1.43.1 prompted me to copy a
to_vec(), when it seems like
clone() is (arguably) better:
| ^^^^ | | | expected struct `std::vec::Vec`, found reference | help: try using a conversion method: `data.to_vec()`