Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions backend/common_utils/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ impl Env {
|_| default_env,
|v| {
Self::deserialize(v.into_deserializer()).unwrap_or_else(|err: serde_json::Error| {
panic!(
"Invalid value found in environment variable {}: {}",
env_key, err
)
panic!("Invalid value found in environment variable {env_key}: {err}")
})
Comment on lines 169 to 171
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect error type annotation causing compile error.

Self::deserialize(v.into_deserializer()) uses a serde::de::value::Error (via IntoDeserializer), not serde_json::Error. The explicit annotation mismatches the actual error type. Drop the type to let inference work.

-                Self::deserialize(v.into_deserializer()).unwrap_or_else(|err: serde_json::Error| {
-                    panic!("Invalid value found in environment variable {env_key}: {err}")
-                })
+                Self::deserialize(v.into_deserializer()).unwrap_or_else(|err| {
+                    panic!("Invalid value found in environment variable {env_key}: {err}")
+                })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Self::deserialize(v.into_deserializer()).unwrap_or_else(|err: serde_json::Error| {
panic!(
"Invalid value found in environment variable {}: {}",
env_key, err
)
panic!("Invalid value found in environment variable {env_key}: {err}")
})
Self::deserialize(v.into_deserializer()).unwrap_or_else(|err| {
panic!("Invalid value found in environment variable {env_key}: {err}")
})
🤖 Prompt for AI Agents
In backend/common_utils/src/consts.rs around lines 161 to 163, the closure in
unwrap_or_else currently annotates the error parameter as serde_json::Error
which is incorrect because Self::deserialize(v.into_deserializer()) yields a
serde::de::value::Error via IntoDeserializer; remove the explicit type
annotation from the closure parameter (i.e., use |err| or let inference pick the
type) so the compiler can infer the correct error type and the code compiles.

},
);
Expand Down
3 changes: 3 additions & 0 deletions backend/connector-integration/src/connectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ pub use self::bluecode::Bluecode;

pub mod cryptopay;
pub use self::cryptopay::Cryptopay;

pub mod peachpayments;
pub use self::peachpayments::Peachpayments;
Loading
Loading