From 5cac7aa8c623d1b6e99d68bfb605632d3870f695 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 24 Aug 2023 16:19:09 -0500 Subject: [PATCH] fix(toml): Remove redundant error messages --- src/cargo/util/toml/mod.rs | 3 +-- tests/testsuite/bad_config.rs | 9 --------- tests/testsuite/build.rs | 9 --------- tests/testsuite/cargo_add/invalid_manifest/stderr.log | 3 --- tests/testsuite/cargo_alias_config.rs | 3 --- tests/testsuite/config.rs | 6 ------ tests/testsuite/git.rs | 3 --- tests/testsuite/inheritable_workspace_fields.rs | 3 --- tests/testsuite/workspaces.rs | 3 --- 9 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 963c4afaa..12ecb8062 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -194,8 +194,7 @@ fn read_manifest_from_str( pub fn parse_document(toml: &str, _file: &Path, _config: &Config) -> CargoResult { // At the moment, no compatibility checks are needed. - toml.parse() - .map_err(|e| anyhow::Error::from(e).context("could not parse input as TOML")) + toml.parse().map_err(Into::into) } /// Warn about paths that have been deprecated and may conflict. diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index 4434ea90d..4c1e66714 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -171,9 +171,6 @@ fn invalid_global_config() { Caused by: could not parse TOML configuration in `[..]` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 1, column 2 | @@ -448,9 +445,6 @@ fn malformed_override() { "\ [ERROR] failed to parse manifest at `[..]` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 8, column 27 | @@ -803,9 +797,6 @@ error: could not load Cargo configuration Caused by: could not parse TOML configuration in `[..]` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 1, column 7 | diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 8cb064a6f..6775cb1de 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -258,9 +258,6 @@ fn cargo_compile_with_invalid_manifest2() { "\ [ERROR] failed to parse manifest at `[..]` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 3, column 23 | @@ -283,9 +280,6 @@ fn cargo_compile_with_invalid_manifest3() { "\ [ERROR] failed to parse manifest at `[..]` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 1, column 5 | @@ -3035,9 +3029,6 @@ fn bad_cargo_config() { Caused by: could not parse TOML configuration in `[..]` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 1, column 6 | diff --git a/tests/testsuite/cargo_add/invalid_manifest/stderr.log b/tests/testsuite/cargo_add/invalid_manifest/stderr.log index 3dabde349..9a8a93b5e 100644 --- a/tests/testsuite/cargo_add/invalid_manifest/stderr.log +++ b/tests/testsuite/cargo_add/invalid_manifest/stderr.log @@ -1,8 +1,5 @@ error: failed to parse manifest at `[ROOT]/case/Cargo.toml` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 8, column 7 | diff --git a/tests/testsuite/cargo_alias_config.rs b/tests/testsuite/cargo_alias_config.rs index fd4aec917..679ca3d5f 100644 --- a/tests/testsuite/cargo_alias_config.rs +++ b/tests/testsuite/cargo_alias_config.rs @@ -52,9 +52,6 @@ fn alias_malformed_config_string() { Caused by: could not parse TOML configuration in `[..]/config` -Caused by: - [..] - Caused by: TOML parse error at line [..] | diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index 009f3d5a3..7078fc445 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -721,9 +721,6 @@ could not load Cargo configuration Caused by: could not parse TOML configuration in `[..]/.cargo/config` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 1, column 5 | @@ -1090,9 +1087,6 @@ could not load Cargo configuration Caused by: could not parse TOML configuration in `[..]/.cargo/config` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 3, column 1 | diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index f60ee978a..ff073451f 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -2577,9 +2577,6 @@ Caused by: Caused by: failed to parse manifest at `[..]` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 8, column 21 | diff --git a/tests/testsuite/inheritable_workspace_fields.rs b/tests/testsuite/inheritable_workspace_fields.rs index cc261a47f..0eb42542d 100644 --- a/tests/testsuite/inheritable_workspace_fields.rs +++ b/tests/testsuite/inheritable_workspace_fields.rs @@ -1321,9 +1321,6 @@ fn error_malformed_workspace_root() { "\ [ERROR] failed to parse manifest at `[..]/foo/Cargo.toml` -Caused by: - [..] - Caused by: [..] | diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index c6698f76a..4f8997b38 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -1090,9 +1090,6 @@ fn new_warning_with_corrupt_ws() { failed to parse manifest at `[..]foo/Cargo.toml` -Caused by: - could not parse input as TOML - Caused by: TOML parse error at line 1, column 5 |