@@ -137,10 +137,9 @@ fn format_crate(
137
137
// Currently only bin and lib files get formatted
138
138
let files: Vec < _ > = targets
139
139
. into_iter ( )
140
- . filter ( |t| t. kind . should_format ( ) )
141
140
. inspect ( |t| {
142
141
if verbosity == Verbosity :: Verbose {
143
- println ! ( "[{:? }] {:?}" , t. kind, t. path)
142
+ println ! ( "[{}] {:?}" , t. kind, t. path)
144
143
}
145
144
} )
146
145
. map ( |t| t. path )
@@ -154,53 +153,13 @@ fn get_fmt_args() -> Vec<String> {
154
153
env:: args ( ) . skip_while ( |a| a != "--" ) . skip ( 1 ) . collect ( )
155
154
}
156
155
157
- #[ derive( Debug ) ]
158
- enum TargetKind {
159
- Lib , // dylib, staticlib, lib
160
- Bin , // bin
161
- Example , // example file
162
- Test , // test file
163
- Bench , // bench file
164
- CustomBuild , // build script
165
- ProcMacro , // a proc macro implementation
166
- Other , // plugin,...
167
- }
168
-
169
- impl TargetKind {
170
- fn should_format ( & self ) -> bool {
171
- match * self {
172
- TargetKind :: Lib
173
- | TargetKind :: Bin
174
- | TargetKind :: Example
175
- | TargetKind :: Test
176
- | TargetKind :: Bench
177
- | TargetKind :: CustomBuild
178
- | TargetKind :: ProcMacro => true ,
179
- _ => false ,
180
- }
181
- }
182
-
183
- fn from_str ( s : & str ) -> Self {
184
- match s {
185
- "bin" => TargetKind :: Bin ,
186
- "lib" | "dylib" | "staticlib" | "cdylib" | "rlib" => TargetKind :: Lib ,
187
- "test" => TargetKind :: Test ,
188
- "example" => TargetKind :: Example ,
189
- "bench" => TargetKind :: Bench ,
190
- "custom-build" => TargetKind :: CustomBuild ,
191
- "proc-macro" => TargetKind :: ProcMacro ,
192
- _ => TargetKind :: Other ,
193
- }
194
- }
195
- }
196
-
197
156
/// Target uses a `path` field for equality and hashing.
198
157
#[ derive( Debug ) ]
199
158
pub struct Target {
200
159
/// A path to the main source file of the target.
201
160
path : PathBuf ,
202
161
/// A kind of target (e.g. lib, bin, example, ...).
203
- kind : TargetKind ,
162
+ kind : String ,
204
163
}
205
164
206
165
impl Target {
@@ -210,7 +169,7 @@ impl Target {
210
169
211
170
Target {
212
171
path : canonicalized,
213
- kind : TargetKind :: from_str ( & target. kind [ 0 ] ) ,
172
+ kind : target. kind [ 0 ] . clone ( ) ,
214
173
}
215
174
}
216
175
}
0 commit comments