It's okay to copy-paste code form crates instead of adding them as dependency

135 points grg994 119 comments

I writing this as a reminder that the decades old way of using someone else code - just copying it to you own source (and adding a line of comment with attribution and license) - still exist and is still an okay thing to do.

The recently compromised arrayref was a single file, (without comments and tests) 150 lines of code crate, containing 4 public macros, seeing no improvements since 2 years - and managed to indirectly subvert winit and wgpu.

Not saying this is viable for large dependencies, but for small crates which are feature-complete for years, I think it's time to embrace the mentality where someone first always ask themself: Can a few Ctrl-C Ctrl-V give me the code I want? - And only add a dependency if the answer is no.