diff options
author | Ondřej Čertík <ondrej@certik.us> | 2020-01-13 04:58:32 +0000 |
---|---|---|
committer | Ondřej Čertík <ondrej@certik.us> | 2020-01-13 04:58:32 +0000 |
commit | d013e49fc77c4c1be7990d706589d5c46c87d317 (patch) | |
tree | 11391b26099e88abf3438524c3e85d41fe85ca9b | |
parent | 4f4c692ae97dfbf5bf769085e32bae5c7a9a7f5c (diff) | |
parent | e1e4e9d459378af32e5abddd89be6b544ad0eb83 (diff) | |
download | fpm-d013e49fc77c4c1be7990d706589d5c46c87d317.tar.gz fpm-d013e49fc77c4c1be7990d706589d5c46c87d317.zip |
Merge branch 'simplify' into 'master'
Simplify code
See merge request certik/fpm!8
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 9252c56..8fb71c2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,8 @@ struct Cli { command: String, } -fn collect_source_files() -> Vec<std::path::PathBuf> { - let mut files: Vec<std::path::PathBuf> = Vec::new(); +fn collect_source_files() -> Vec<String> { + let mut files: Vec<String> = Vec::new(); for entry in std::fs::read_dir(".").unwrap() { let entry = entry.unwrap(); let path = entry.path(); @@ -17,7 +17,7 @@ fn collect_source_files() -> Vec<std::path::PathBuf> { Some(ext) => ext.to_str().unwrap(), }; if ext == "f90" { - files.push(path); + files.push(path.to_str().unwrap().to_string()); } } } @@ -28,11 +28,9 @@ fn build() { let files = collect_source_files(); let mut files2: String = String::new(); for file in &files { - println!("File: {}", file.to_str().unwrap()); - if !file.to_str().unwrap().ends_with("main.f90") { - let s1:String = files2.to_string(); - let s2:String = file.to_str().unwrap().to_string(); - files2 = s1 + " " + &s2; + println!("File: {}", file); + if !file.ends_with("main.f90") { + files2 = files2 + " " + file; } } println!("Files: {:?}", files); |