Commit Graph

21 Commits

Author SHA1 Message Date
Eric Huss 888100352a Move ProcessBuilder to cargo-util. 2021-03-20 15:19:03 -07:00
Matthias Krüger c4e5670bdb Fix more clippy warnings;
clippy::comparison_to_empty
clippy::needless_question_mark
clippy::needless_borrow
clippy::match_like_matches_macro
clippy::vec_init_then_push
clippy::redundant_clone
clippy::nonminimal_bool
clippy::ptr_arg
2021-01-06 15:15:22 +01:00
Eric Huss 62711bd385 Forbid certain macros in the codebase. 2020-05-13 16:22:51 -07:00
Alex Crichton c85ed0447b Remove lifetime from `Unit` 2020-04-19 10:37:16 -07:00
Alex Crichton 3a18c89a55 Migrate from the `failure` crate to `anyhow`
The `anyhow` crate interoperates with the `std::error::Error` trait
rather than a custom `Fail` trait, and this is the general trend of
error handling in Rust as well.

Note that this is mostly mechanical (sed) and intended to get the test
suite passing. As usual there's still more idiomatic cleanup that can
happen, but that's left to later commits.
2020-01-07 16:50:09 -08:00
Eric Huss cc9f5a87d3 Remove dep_targets. 2019-11-23 15:38:51 -08:00
Alex Crichton ef425b77e2 Refactor how compile targets are handled
Rename `Kind` to `CompileKind` to reflect that it's intended for
compilation. Additionally change the `Target` variant to have a newtype
`CompileTarget` instead of just being a raw string. This new
`CompileTarget` type has a fallible constructor and handles custom json
target files internally.

Two accessors are available for `CompileTarget`, one is `rustc_target()`
which goes straight to rustc and everything else uses `short_name()`
which is the raw target or file stem for json files. The `short_name` is
used everywhere in Cargo for all purposes like configuration, env vars,
target directory naming, etc.
2019-09-26 08:23:24 -07:00
Alex Crichton e45444665c Intern units for fast hashing
This commit starts to intern `Unit` structures for a few reasons:

* This primarily makes equality and hashing much faster. We have tons of
  hash lookups with units, and they were showing up quite high
  in profiles. It turns out `Unit` hashes a *ton* of data, and most of
  it is always redundant. To handle this they're all only hashed once
  now and hashing/equality are just pointer checks.

* The size of `Unit` is now drastically reduced to just one pointer, so
  movement of units throughout the backend should be much more
  efficient.
2019-04-22 15:06:37 -07:00
Eric Huss ef0b47769b Cleanup: Remove unnecessary borrows. 2019-03-26 18:09:56 -07:00
Dale Wijnand 54c4214251
Remove trailing extern crate usage 2018-12-13 15:21:32 +00:00
Alex Crichton b8b7faee50 Run `cargo fix --edition-idioms` and fixup output
This gets Cargo passing the `--edition-idioms` lints and more down the
road of the 2018 edition!
2018-12-11 05:45:46 -08:00
Alex Crichton 9ed82b5779 Start using 2018 idioms in Cargo
Remove a number of `extern crate` directives and tweak a number of
imports. Not all `extern crate` is gone yet but this is the bulk of
them!
2018-12-11 05:45:46 -08:00
Alex Crichton fecb724643 Format with `cargo fmt` 2018-12-08 03:19:47 -08:00
Dale Wijnand 04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Eh2406 dae87a2624 PackageId is copy, clippy thinks we dont need &PackageId or PackageId.clone() 2018-11-27 17:43:23 -05:00
Dale Wijnand 7b081569ed
Distinguish custom build invocations
Distinguish building a build script from running it,
in build plan invocations.
2018-11-18 17:59:05 +00:00
Zach Lute 3492a3905c Replace 'project' with 'package' in many strings and comments. 2018-09-20 23:47:09 -07:00
Eh2406 f57990808e more general update 2018-07-21 18:55:14 -04:00
Eh2406 385b54b38f a large number of clippy suggestions 2018-07-21 18:55:14 -04:00
Alex Crichton a071c3ab9b Fixup some minor review comments 2018-05-10 12:08:06 -07:00
Mike Shal 72e6b9d326 Add --build-plan for 'cargo build'
With 'cargo build --build-plan', cargo does not actually run any
commands, but instead prints out what it would have done in the form of
a JSON data structure.

Fixes #3815
2018-05-07 17:35:47 -04:00