File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ pub enum GitRepo {
191191/// although most functions are implemented as free functions rather than
192192/// methods specifically on this structure itself (to make it easier to
193193/// organize).
194- #[ cfg_attr ( not ( feature = "build-metrics" ) , derive( Clone ) ) ]
194+ #[ derive( Clone ) ]
195195pub struct Build {
196196 /// User-specified configuration from `config.toml`.
197197 config : Config ,
Original file line number Diff line number Diff line change @@ -40,6 +40,13 @@ pub(crate) struct BuildMetrics {
4040 state : RefCell < MetricsState > ,
4141}
4242
43+ /// NOTE: this isn't really cloning anything, but `x suggest` doesn't need metrics so this is probably ok.
44+ impl Clone for BuildMetrics {
45+ fn clone ( & self ) -> Self {
46+ Self :: init ( )
47+ }
48+ }
49+
4350impl BuildMetrics {
4451 pub ( crate ) fn init ( ) -> Self {
4552 let state = RefCell :: new ( MetricsState {
Original file line number Diff line number Diff line change @@ -8,13 +8,7 @@ use clap::Parser;
88
99use crate :: { builder:: Builder , tool:: Tool } ;
1010
11- #[ cfg( feature = "build-metrics" ) ]
12- pub fn suggest ( builder : & Builder < ' _ > , run : bool ) {
13- panic ! ( "`x suggest` is not supported with `build-metrics`" )
14- }
15-
1611/// Suggests a list of possible `x.py` commands to run based on modified files in branch.
17- #[ cfg( not( feature = "build-metrics" ) ) ]
1812pub fn suggest ( builder : & Builder < ' _ > , run : bool ) {
1913 let suggestions =
2014 builder. tool_cmd ( Tool :: SuggestTests ) . output ( ) . expect ( "failed to run `suggest-tests` tool" ) ;
@@ -66,7 +60,7 @@ pub fn suggest(builder: &Builder<'_>, run: bool) {
6660
6761 if run {
6862 for sug in suggestions {
69- let mut build = builder. build . clone ( ) ;
63+ let mut build: crate :: Build = builder. build . clone ( ) ;
7064 build. config . paths = sug. 2 ;
7165 build. config . cmd = crate :: flags:: Flags :: parse_from ( [ sug. 0 ] ) . cmd ;
7266 if let Some ( stage) = sug. 1 {
You can’t perform that action at this time.
0 commit comments