From 1738fe51e5c9ec18bc1488cbf71ef3b86e10c14d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 19 Dec 2018 12:13:45 +0000 Subject: [PATCH 01/91] Bump rustc-serialize from 0.3.23 to 0.3.24 Bumps [rustc-serialize](https://github.com/rust-lang/rustc-serialize) from 0.3.23 to 0.3.24. - [Release notes](https://github.com/rust-lang/rustc-serialize/releases) - [Commits](https://github.com/rust-lang/rustc-serialize/compare/0.3.23...0.3.24) Signed-off-by: dependabot[bot] --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15f73223..67640af9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,7 +14,7 @@ dependencies = [ "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "scan-rules 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -260,7 +260,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-serialize" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -310,7 +310,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -405,7 +405,7 @@ name = "toml" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -478,7 +478,7 @@ dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ktmw32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -514,7 +514,7 @@ dependencies = [ "checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01" "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" "checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457" -"checksum rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "684ce48436d6465300c9ea783b6b14c4361d6b8dcbb1375b486a69cc19e2dfb0" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum scan-rules 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc8b462b0f8ce7deae199b4b5cecbbe01006f808408d815c09a9f7b11ee044ac" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" diff --git a/Cargo.toml b/Cargo.toml index d99e16f2..d9438cdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ lazy_static = "0.2.6" log = "0.3.7" open = "1.2.0" regex = "0.2.1" -rustc-serialize = "0.3.23" +rustc-serialize = "0.3.24" semver = "0.5.1" # semver 0.6 incompatible with Rust < 1.14 shaman = "0.1.0" time = "0.1.36" From b7b23702fc4ca57acc0fdc6558536d816cb8e07f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 19 Dec 2018 12:13:45 +0000 Subject: [PATCH 02/91] Bump chan from 0.1.19 to 0.1.23 Bumps [chan](https://github.com/BurntSushi/chan) from 0.1.19 to 0.1.23. - [Release notes](https://github.com/BurntSushi/chan/releases) - [Commits](https://github.com/BurntSushi/chan/compare/0.1.19...0.1.23) Signed-off-by: dependabot[bot] --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67640af9..62b4c507 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,7 +3,7 @@ name = "cargo-script" version = "0.2.9" dependencies = [ "atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "chan 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "chan 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.23.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", @@ -80,7 +80,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "chan" -version = "0.1.19" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -490,7 +490,7 @@ dependencies = [ "checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159" "checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23" "checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" -"checksum chan 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "f93bfe971116428a9066c1c3c69a09ae3ef69432f8418be28ab50f96783e6a50" +"checksum chan 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "d14956a3dae065ffaa0d92ece848ab4ced88d32361e7fdfbfd653a5c454a1ed8" "checksum clap 2.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf1114886d7cde2d6448517161d7db8d681a9a1c09f7d210f0b0864e48195f6" "checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a" "checksum env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e3856f1697098606fc6cb97a93de88ca3f3bc35bb878c725920e6e82ecf05e83" diff --git a/Cargo.toml b/Cargo.toml index d9438cdc..ab0b1e56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ default = ["suppress-cargo-output"] suppress-cargo-output = ["chan"] [dependencies] -chan = { version = "0.1.19", optional = true } +chan = { version = "0.1.23", optional = true } clap = "2.23.2" env_logger = "0.4.2" hoedown = "6.0.0" From f912e94d059ae78ef0deb92c5d1016dbe7b27e16 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Thu, 24 Jan 2019 10:16:26 -0700 Subject: [PATCH 03/91] Bump minimum Rust version to 1.13 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1bdef0f2..bdf8e413 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: rust script: rustc -vV && cargo build --verbose && cargo test --verbose rust: - - 1.11.0 + - 1.13.0 - 1.14.0 - 1.17.0 - stable From 43c95abd2e5eb533056e02bdaebd9ed8c806f510 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Thu, 24 Jan 2019 11:56:12 -0700 Subject: [PATCH 04/91] Remove `try/`?` operator compatibility shims, since `?` is stable since Rust 1.13 (now new minimum) --- build.rs | 7 ------- tests/tests/expr.rs | 6 +----- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/build.rs b/build.rs index 28b5f5e2..37561b02 100644 --- a/build.rs +++ b/build.rs @@ -28,11 +28,4 @@ fn main() { if version_matches("<1.15.0") { println!("cargo:rustc-cfg=old_rustc_windows_linking_behaviour"); } - - /* - Before 1.13, there was no `?` operator. One of the tests needs this information. - */ - if version_matches(">=1.13.0") { - println!("cargo:rustc-cfg=has_qmark"); - } } diff --git a/tests/tests/expr.rs b/tests/tests/expr.rs index c22cbc5a..7adaa3bb 100644 --- a/tests/tests/expr.rs +++ b/tests/tests/expr.rs @@ -75,11 +75,7 @@ fn test_expr_panic() { #[test] fn test_expr_qmark() { - let code = if cfg!(has_qmark) { - with_output_marker!("\"42\".parse::()?.wrapping_add(1)") - } else { - with_output_marker!("try!(\"42\".parse::()).wrapping_add(1)") - }; + let code = with_output_marker!("\"42\".parse::()?.wrapping_add(1)"); let out = cargo_script!("-e", code).unwrap(); scan!(out.stdout_output(); ("43") => () From 90ecf3422585e652b6d7d96bddedda1c2b157440 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Thu, 24 Jan 2019 13:14:00 -0700 Subject: [PATCH 05/91] Replace usages of `try!` macro with the `Try` operator (`?`) --- src/file_assoc.rs | 40 +++++------ src/main.rs | 167 ++++++++++++++++++++++------------------------ src/manifest.rs | 49 +++++++------- src/platform.rs | 22 +++--- src/templates.rs | 30 ++++----- src/util.rs | 2 +- 6 files changed, 148 insertions(+), 162 deletions(-) diff --git a/src/file_assoc.rs b/src/file_assoc.rs index b3fc451c..9524cabd 100644 --- a/src/file_assoc.rs +++ b/src/file_assoc.rs @@ -61,8 +61,8 @@ impl Args { pub fn try_main(args: Args) -> Result { match args { - Args::Install { amend_pathext } => try!(install(amend_pathext)), - Args::Uninstall => try!(uninstall()), + Args::Install { amend_pathext } => install(amend_pathext)?, + Args::Uninstall => uninstall()?, } Ok(0) @@ -74,8 +74,8 @@ fn install(amend_pathext: bool) -> Result<()> { use self::winreg::enums as wre; // Set up file association. - let cs_path = try!(env::current_exe()); - let cs_path = try!(cs_path.canonicalize()); + let cs_path = env::current_exe()?; + let cs_path = cs_path.canonicalize()?; let rcs_path = cs_path.with_file_name("run-cargo-script.exe"); if !rcs_path.exists() { @@ -92,14 +92,14 @@ fn install(amend_pathext: bool) -> Result<()> { let res = (|| -> io::Result<()> { let hlcr = RegKey::predef(wre::HKEY_CLASSES_ROOT); - let dot_crs = try!(hlcr.create_subkey(".crs")); - try!(dot_crs.set_value("", &"CargoScript.Crs")); + let dot_crs = hlcr.create_subkey(".crs")?; + dot_crs.set_value("", &"CargoScript.Crs")?; - let cs_crs = try!(hlcr.create_subkey("CargoScript.Crs")); - try!(cs_crs.set_value("", &"Cargo Script")); + let cs_crs = hlcr.create_subkey("CargoScript.Crs")?; + cs_crs.set_value("", &"Cargo Script")?; - let sh_o_c = try!(cs_crs.create_subkey(r#"shell\open\command"#)); - try!(sh_o_c.set_value("", &format!(r#""{}" "%1" %*"#, rcs_path))); + let sh_o_c = cs_crs.create_subkey(r#"shell\open\command"#)?; + sh_o_c.set_value("", &format!(r#""{}" "%1" %*"#, rcs_path))?; Ok(()) })(); @@ -123,12 +123,12 @@ fn install(amend_pathext: bool) -> Result<()> { use std::ascii::AsciiExt; let hklm = RegKey::predef(wre::HKEY_LOCAL_MACHINE); - let env = try!(hklm.open_subkey(r#"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"#)); + let env = hklm.open_subkey(r#"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"#)?; - let pathext: String = try!(env.get_value("PATHEXT")); + let pathext: String = env.get_value("PATHEXT")?; if !pathext.split(";").any(|e| e.eq_ignore_ascii_case(".crs")) { let pathext = pathext.split(";").chain(Some(".CRS")).join(";"); - try!(env.set_value("PATHEXT", &pathext)); + env.set_value("PATHEXT", &pathext)?; } println!("Added `.crs` to PATHEXT. You may need to log out for the change to take effect."); @@ -146,10 +146,10 @@ fn uninstall() -> Result<()> { let mut notify = || ignored_missing = true; let hlcr = RegKey::predef(wre::HKEY_CLASSES_ROOT); - try!(hlcr.delete_subkey(r#"CargoScript.Crs\shell\open\command"#).ignore_missing_and(&mut notify)); - try!(hlcr.delete_subkey(r#"CargoScript.Crs\shell\open"#).ignore_missing_and(&mut notify)); - try!(hlcr.delete_subkey(r#"CargoScript.Crs\shell"#).ignore_missing_and(&mut notify)); - try!(hlcr.delete_subkey(r#"CargoScript.Crs"#).ignore_missing_and(&mut notify)); + hlcr.delete_subkey(r#"CargoScript.Crs\shell\open\command"#).ignore_missing_and(&mut notify)?; + hlcr.delete_subkey(r#"CargoScript.Crs\shell\open"#).ignore_missing_and(&mut notify)?; + hlcr.delete_subkey(r#"CargoScript.Crs\shell"#).ignore_missing_and(&mut notify)?; + hlcr.delete_subkey(r#"CargoScript.Crs"#).ignore_missing_and(&mut notify)?; } if ignored_missing { @@ -161,12 +161,12 @@ fn uninstall() -> Result<()> { use std::ascii::AsciiExt; let hklm = RegKey::predef(wre::HKEY_LOCAL_MACHINE); - let env = try!(hklm.open_subkey(r#"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"#)); + let env = hklm.open_subkey(r#"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"#)?; - let pathext: String = try!(env.get_value("PATHEXT")); + let pathext: String = env.get_value("PATHEXT")?; if pathext.split(";").any(|e| e.eq_ignore_ascii_case(".crs")) { let pathext = pathext.split(";").filter(|e| !e.eq_ignore_ascii_case(".crs")).join(";"); - try!(env.set_value("PATHEXT", &pathext)); + env.set_value("PATHEXT", &pathext)?; println!("Removed `.crs` from PATHEXT. You may need to log out for the change to take effect."); } } diff --git a/src/main.rs b/src/main.rs index 1ac1e0ff..aa838546 100644 --- a/src/main.rs +++ b/src/main.rs @@ -450,8 +450,8 @@ fn try_main() -> Result { } if log_enabled!(log::LogLevel::Debug) { - let scp = try!(get_script_cache_path()); - let bcp = try!(get_binary_cache_path()); + let scp = get_script_cache_path()?; + let bcp = get_binary_cache_path()?; debug!("script-cache path: {:?}", scp); debug!("binary-cache path: {:?}", bcp); } @@ -463,7 +463,7 @@ fn try_main() -> Result { 2. Do it *before* we start trying to read the input so that, later on, we can make `