about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-08-27 13:14:19 +0900
committerGitHub <noreply@github.com>2022-08-27 13:14:19 +0900
commite31bedc9cf52490f4228c84e652ef5387184f75a (patch)
tree391099bed4e9214ecc487a8180c3bfe87e5bc4da /src
parent7214f0cfc42c8a63ea039ddb82bd8790884c475f (diff)
parent754b3e7567a441288ff7ce7f72280f267044113b (diff)
Rollup merge of #100924 - est31:closure_to_fn_ptr, r=Mark-Simulacrum
Smaller improvements of tidy and the unicode generator
Diffstat (limited to 'src')
-rw-r--r--src/tools/tidy/src/error_codes_check.rs2
-rw-r--r--src/tools/unicode-table-generator/src/main.rs2
-rw-r--r--src/tools/unicode-table-generator/src/unicode_download.rs31
3 files changed, 17 insertions, 18 deletions
diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs
index f0054a1c1c9..0a226443e01 100644
--- a/src/tools/tidy/src/error_codes_check.rs
+++ b/src/tools/tidy/src/error_codes_check.rs
@@ -217,7 +217,7 @@ pub fn check(paths: &[&Path], bad: &mut bool) {
     println!("Checking which error codes lack tests...");
 
     for path in paths {
-        super::walk(path, &mut |path| super::filter_dirs(path), &mut |entry, contents| {
+        super::walk(path, &mut super::filter_dirs, &mut |entry, contents| {
             let file_name = entry.file_name();
             let entry_path = entry.path();
 
diff --git a/src/tools/unicode-table-generator/src/main.rs b/src/tools/unicode-table-generator/src/main.rs
index a3327a3c2ff..2fe578acd90 100644
--- a/src/tools/unicode-table-generator/src/main.rs
+++ b/src/tools/unicode-table-generator/src/main.rs
@@ -221,7 +221,7 @@ fn main() {
     let write_location = std::env::args().nth(1).unwrap_or_else(|| {
         eprintln!("Must provide path to write unicode tables to");
         eprintln!(
-            "e.g. {} library/core/unicode/unicode_data.rs",
+            "e.g. {} library/core/src/unicode/unicode_data.rs",
             std::env::args().next().unwrap_or_default()
         );
         std::process::exit(1);
diff --git a/src/tools/unicode-table-generator/src/unicode_download.rs b/src/tools/unicode-table-generator/src/unicode_download.rs
index 9b2e0a25891..714bb53382e 100644
--- a/src/tools/unicode-table-generator/src/unicode_download.rs
+++ b/src/tools/unicode-table-generator/src/unicode_download.rs
@@ -1,6 +1,6 @@
 use crate::UNICODE_DIRECTORY;
 use std::path::Path;
-use std::process::Command;
+use std::process::{Command, Output};
 
 static URL_PREFIX: &str = "https://www.unicode.org/Public/UCD/latest/ucd/";
 
@@ -9,6 +9,18 @@ static README: &str = "ReadMe.txt";
 static RESOURCES: &[&str] =
     &["DerivedCoreProperties.txt", "PropList.txt", "UnicodeData.txt", "SpecialCasing.txt"];
 
+#[track_caller]
+fn fetch(url: &str) -> Output {
+    let output = Command::new("curl").arg(URL_PREFIX.to_owned() + url).output().unwrap();
+    if !output.status.success() {
+        panic!(
+            "Failed to run curl to fetch {url}: stderr: {}",
+            String::from_utf8_lossy(&output.stderr)
+        );
+    }
+    output
+}
+
 pub fn fetch_latest() {
     let directory = Path::new(UNICODE_DIRECTORY);
     if directory.exists() {
@@ -20,27 +32,14 @@ pub fn fetch_latest() {
     if let Err(e) = std::fs::create_dir_all(directory) {
         panic!("Failed to create {UNICODE_DIRECTORY:?}: {e}");
     }
-    let output = Command::new("curl").arg(URL_PREFIX.to_owned() + README).output().unwrap();
-    if !output.status.success() {
-        panic!(
-            "Failed to run curl to fetch readme: stderr: {}",
-            String::from_utf8_lossy(&output.stderr)
-        );
-    }
+    let output = fetch(README);
     let current = std::fs::read_to_string(directory.join(README)).unwrap_or_default();
     if current.as_bytes() != &output.stdout[..] {
         std::fs::write(directory.join(README), output.stdout).unwrap();
     }
 
     for resource in RESOURCES {
-        let output = Command::new("curl").arg(URL_PREFIX.to_owned() + resource).output().unwrap();
-        if !output.status.success() {
-            panic!(
-                "Failed to run curl to fetch {}: stderr: {}",
-                resource,
-                String::from_utf8_lossy(&output.stderr)
-            );
-        }
+        let output = fetch(resource);
         std::fs::write(directory.join(resource), output.stdout).unwrap();
     }
 }