Repository: intellij-rust/intellij-rust
Issue: Fetching Cargo Config failed.

## Environment

* **IntelliJ Rust plugin version:** 0.4.176.4815-222
* **Rust toolchain version:** 1.63.0
* **IDE name and version:** CLion 2022.2.1 Build #CL-222.3739.54 
* **Operating system:** ArchLinux

## Problem description
When syncing the project, the following error is shown:

> Fetching Cargo Config failed.
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "force" (class org.rust.cargo.CargoConfig$EnvValue), not marked as ignorable (3 known properties: "value", "relative", "forced"])
 at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: org.rust.cargo.CargoConfig$EnvValue["force"])

## Steps to reproduce
Put an entry like
>[env]
TMPDIR = { value = "~/tmp/cargo", force = true }

in ~/.cargo/config.toml.
Sync the project.


Changed files:
src/test/kotlin/org/rust/cargo/toolchain/CargoConfigTest.kt, src/main/kotlin/org/rust/cargo/toolchain/tools/Cargo.kt, src/main/kotlin/org/rust/cargo/CargoConfig.kt

diff --git a/src/main/kotlin/org/rust/cargo/CargoConfig.kt b/src/main/kotlin/org/rust/cargo/CargoConfig.kt
index 0a9d87e64..6eb03b643 100644
--- a/src/main/kotlin/org/rust/cargo/CargoConfig.kt
+++ b/src/main/kotlin/org/rust/cargo/CargoConfig.kt
@@ -5,6 +5,7 @@
 
 package org.rust.cargo
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties
 import com.fasterxml.jackson.annotation.JsonProperty
 
 /**
@@ -15,10 +16,11 @@ data class CargoConfig(
     val env: Map<String, EnvValue>,
 
 ) {
+    @JsonIgnoreProperties(ignoreUnknown = true)
     data class EnvValue(
         @JsonProperty("value")
         val value: String,
-        @JsonProperty("forced")
+        @JsonProperty("force")
         val isForced: Boolean = false,
         @JsonProperty("relative")
         val isRelative: Boolean = false
diff --git a/src/main/kotlin/org/rust/cargo/toolchain/tools/Cargo.kt b/src/main/kotlin/org/rust/cargo/toolchain/tools/Cargo.kt
index 67dfbe39d..429b310f6 100644
--- a/src/main/kotlin/org/rust/cargo/toolchain/tools/Cargo.kt
+++ b/src/main/kotlin/org/rust/cargo/toolchain/tools/Cargo.kt
@@ -233,6 +233,7 @@ class Cargo(
         val tree = try {
             TOML_MAPPER.readTree(output)
         } catch (e: JacksonException) {
+            LOG.error(e)
             return Err(RsDeserializationException(e))
         }
 
@@ -247,6 +248,7 @@ class Cargo(
                 val valueParams = try {
                     TOML_MAPPER.treeToValue(field.value, CargoConfig.EnvValue::class.java)
                 } catch (e: JacksonException) {
+                    LOG.error(e)
                     return Err(RsDeserializationException(e))
                 }
                 field.key to CargoConfig.EnvValue(valueParams.value, valueParams.isForced, valueParams.isRelative)
diff --git a/src/test/kotlin/org/rust/cargo/toolchain/CargoConfigTest.kt b/src/test/kotlin/org/rust/cargo/toolchain/CargoConfigTest.kt
index aa477bbb9..412685a79 100644
--- a/src/test/kotlin/org/rust/cargo/toolchain/CargoConfigTest.kt
+++ b/src/test/kotlin/org/rust/cargo/toolchain/CargoConfigTest.kt
@@ -49,8 +49,9 @@ class CargoConfigTest : RsWithToolchainTestBase() {
                 toml("config.toml", """
                     [env]
                     foo = "42"
-                    bar = { value = "24", forced = true }
+                    bar = { value = "24", force = true }
                     baz = { value = "hello/world", relative = true }
+                    qwe = { value = "value", unknown_field = 123 }
                 """)
             }
             file("Cargo.toml", CARGO_TOML)
@@ -62,6 +63,7 @@ class CargoConfigTest : RsWithToolchainTestBase() {
         assertEquals(CargoConfig.EnvValue("42"), env["foo"])
         assertEquals(CargoConfig.EnvValue("24", isForced = true), env["bar"])
         assertEquals(CargoConfig.EnvValue("hello/world", isRelative = true), env["baz"])
+        assertEquals(CargoConfig.EnvValue("value"), env["qwe"])
     }
 
     companion object {