@@ -80,14 +80,7 @@ fn write(
80
80
. file_stem ( )
81
81
. ok_or_else ( || anyhow:: format_err!( "no file name" ) ) ?
82
82
. to_string_lossy ( ) ;
83
- let separator = if file_name. contains ( '_' ) {
84
- '_'
85
- } else {
86
- // Since embedded manifests only support `[[bin]]`s, prefer arrow-case as that is the
87
- // more common convention for CLIs
88
- '-'
89
- } ;
90
- let name = sanitize_name ( file_name. as_ref ( ) , separator) ;
83
+ let name = sanitize_name ( file_name. as_ref ( ) ) ;
91
84
92
85
let mut workspace_root = target_dir. to_owned ( ) ;
93
86
workspace_root. push ( "eval" ) ;
@@ -147,14 +140,7 @@ fn expand_manifest_(script: &RawScript, config: &Config) -> CargoResult<toml::Ta
147
140
. file_stem ( )
148
141
. ok_or_else ( || anyhow:: format_err!( "no file name" ) ) ?
149
142
. to_string_lossy ( ) ;
150
- let separator = if file_name. contains ( '_' ) {
151
- '_'
152
- } else {
153
- // Since embedded manifests only support `[[bin]]`s, prefer arrow-case as that is the
154
- // more common convention for CLIs
155
- '-'
156
- } ;
157
- let name = sanitize_name ( file_name. as_ref ( ) , separator) ;
143
+ let name = sanitize_name ( file_name. as_ref ( ) ) ;
158
144
let bin_name = name. clone ( ) ;
159
145
package
160
146
. entry ( "name" . to_owned ( ) )
@@ -207,7 +193,15 @@ fn expand_manifest_(script: &RawScript, config: &Config) -> CargoResult<toml::Ta
207
193
}
208
194
209
195
/// Ensure the package name matches the validation from `ops::cargo_new::check_name`
210
- fn sanitize_name ( name : & str , placeholder : char ) -> String {
196
+ fn sanitize_name ( name : & str ) -> String {
197
+ let placeholder = if name. contains ( '_' ) {
198
+ '_'
199
+ } else {
200
+ // Since embedded manifests only support `[[bin]]`s, prefer arrow-case as that is the
201
+ // more common convention for CLIs
202
+ '-'
203
+ } ;
204
+
211
205
let mut name = restricted_names:: sanitize_package_name ( name, placeholder) ;
212
206
213
207
loop {
0 commit comments