Skip to content

Commit ebf1dfc

Browse files
committed
Simplify code somewhat
1 parent 36431f4 commit ebf1dfc

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

src/consts.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,6 @@ path = "#{file}.rs"
169169
strip = true
170170
"##;
171171

172-
/**
173-
The name of the package metadata file.
174-
*/
175-
pub const METADATA_FILE: &str = "metadata.json";
176-
177172
/**
178173
When generating a package's unique ID, how many hex nibbles of the digest should be used *at most*?
179174

src/main.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ fn try_main() -> MainResult<i32> {
353353
return Ok(0);
354354
}
355355

356-
// Take the arguments and work out what our input is going to be. Primarily, this gives us the content, a user-friendly name, and a cache-friendly ID.
356+
// Take the arguments and work out what our input is going to be.
357+
// Primarily, this gives us the content, a user-friendly name, and a cache-friendly ID.
357358
// These three are just storage for the borrows we'll actually use.
358359
let script_name: String;
359360
let script_path: PathBuf;
@@ -371,11 +372,11 @@ fn try_main() -> MainResult<i32> {
371372

372373
let mut body = String::new();
373374
file.read_to_string(&mut body)?;
375+
content = body;
374376

375377
let mtime = platform::file_last_modified(&file);
376378

377379
script_path = std::env::current_dir()?.join(path);
378-
content = body;
379380

380381
Input::File(&script_name, &script_path, &content, mtime)
381382
}
@@ -741,9 +742,6 @@ struct PackageMetadata {
741742
/// Last-modified timestamp for script file.
742743
modified: Option<u128>,
743744

744-
/// Template used.
745-
template: Option<String>,
746-
747745
/// Was the script compiled in debug mode?
748746
debug: bool,
749747

@@ -801,17 +799,15 @@ fn decide_action_for(
801799
};
802800

803801
let input_meta = {
804-
let (path, mtime, template) = match *input {
802+
let (path, mtime) = match *input {
805803
Input::File(_, path, _, mtime) => {
806-
(Some(path.to_string_lossy().into_owned()), Some(mtime), None)
804+
(Some(path.to_string_lossy().into_owned()), Some(mtime))
807805
}
808-
Input::Expr(_, template) => (None, None, template),
809-
Input::Loop(..) => (None, None, None),
806+
_ => (None, None)
810807
};
811808
PackageMetadata {
812809
path,
813810
modified: mtime,
814-
template: template.map(Into::into),
815811
debug,
816812
deps,
817813
prelude,
@@ -910,7 +906,7 @@ fn get_pkg_metadata_path<P>(pkg_path: P) -> PathBuf
910906
where
911907
P: AsRef<Path>,
912908
{
913-
pkg_path.as_ref().join(consts::METADATA_FILE)
909+
pkg_path.as_ref().join("metadata.json")
914910
}
915911

916912
/**

0 commit comments

Comments
 (0)