Comments (5)
FWIW, I tried to remove the macro by implementing Deref/DerefMut<Target=Command>
for the wrappers instead. It would have worked.. were it not for the builder pattern :) Because if we implement the helper functions (like env
) on Command
directly, then they have to return &mut Self
, which means that you would have to use all of the top-level command wrapper methods before using any of the Command
methods, which is annoying. For example, rustc().crate_type().env()
would work, but rustc().env().crate_type()
wouldn't work, because env()
would return Command
, and not Rustc
.
I'm not aware of any way of resolving this without using a macro. That being said, I think that the current macro is fine, it just adds a bunch of methods, and does not have any specific requirements on the wrapper apart from having a cmd
field. The documentation needs to be updated though (#126188).
from rust.
I'm going to close this issue, because I think using a trait here unfortunately just makes the API worse.
from rust.
Drawback: test writer would need to bring the trait into scope to use the helper methods...
from rust.
There could be inherent methods that simply forward to the trait methods. That's more boilerplate though.
from rust.
We don't need command_output
on each wrapper struct anymore as of #126121. I don't think that a trait pulls its weight here, due the tests having to import it (it's a bit annoying since run-make tests are typically not very friendly with IDEs). It would be nice to remove the macro, but we can do that also with other approaches than a trait (e.g. Deref
).
from rust.
Related Issues (20)
- rustdoc json output on stdout ? HOT 1
- cannot run cargo because windows CMD error : "[0x7FFBC7A07FA4] ANOMALY: use of REX.w is meaningless (default operand size is 64)" HOT 6
- ICE because of a bad file on disk? HOT 7
- confusing error when trying to call a not-in-scope method that shares a name with a field HOT 1
- rustc SIGSEGV compiling rug 1.24.1 crate on RISC-V Armbian 24.5.0 HOT 2
- Clang linker script support - incorrect argument HOT 11
- E0432: "help: a macro with this name exists at the root of the crate" suggestion incorrect HOT 2
- fmt bug for tuple type access HOT 2
- Wrong codegen for simd_select_bitmask on big-endian targets HOT 2
- Mutable reference prevents value from being moved to its current address HOT 2
- Tracking Issue for `XOP` target feature HOT 2
- ICE when type not specificed for static variable (Embassy) HOT 5
- Tracking Issue for AVX512_FP16 intrinsics
- `*x == *y` for trait objects produce move error, so it is not equivalent to `PartialEq::eq(&*x, &*y)` even though the reference says it is HOT 1
- Fix (?) dependency tracking for the metavar span table
- ICE: `Size != Size` HOT 1
- ICE: `associated_item_def_ids: not impl or trait` HOT 1
- Incorrect "closure bodies that contain statements must be surrounded by braces" error in unrelatedly invalid code HOT 1
- rustdoc: support for `async Fn*` trait bounds HOT 1
- rustdoc: support for precise capturing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.