File tree 3 files changed +9
-8
lines changed
3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ pub enum GitRepo {
191
191
/// although most functions are implemented as free functions rather than
192
192
/// methods specifically on this structure itself (to make it easier to
193
193
/// organize).
194
- #[ cfg_attr ( not ( feature = "build-metrics" ) , derive( Clone ) ) ]
194
+ #[ derive( Clone ) ]
195
195
pub struct Build {
196
196
/// User-specified configuration from `config.toml`.
197
197
config : Config ,
Original file line number Diff line number Diff line change @@ -40,6 +40,13 @@ pub(crate) struct BuildMetrics {
40
40
state : RefCell < MetricsState > ,
41
41
}
42
42
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
+
43
50
impl BuildMetrics {
44
51
pub ( crate ) fn init ( ) -> Self {
45
52
let state = RefCell :: new ( MetricsState {
Original file line number Diff line number Diff line change @@ -8,13 +8,7 @@ use clap::Parser;
8
8
9
9
use crate :: { builder:: Builder , tool:: Tool } ;
10
10
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
-
16
11
/// Suggests a list of possible `x.py` commands to run based on modified files in branch.
17
- #[ cfg( not( feature = "build-metrics" ) ) ]
18
12
pub fn suggest ( builder : & Builder < ' _ > , run : bool ) {
19
13
let suggestions =
20
14
builder. tool_cmd ( Tool :: SuggestTests ) . output ( ) . expect ( "failed to run `suggest-tests` tool" ) ;
@@ -66,7 +60,7 @@ pub fn suggest(builder: &Builder<'_>, run: bool) {
66
60
67
61
if run {
68
62
for sug in suggestions {
69
- let mut build = builder. build . clone ( ) ;
63
+ let mut build: crate :: Build = builder. build . clone ( ) ;
70
64
build. config . paths = sug. 2 ;
71
65
build. config . cmd = crate :: flags:: Flags :: parse_from ( [ sug. 0 ] ) . cmd ;
72
66
if let Some ( stage) = sug. 1 {
You can’t perform that action at this time.
0 commit comments