Skip to content

Remove unnecessary unsafe blocks around environment variable calls in config.rs #5

@coderabbitai

Description

@coderabbitai

Description

There are 4 unnecessary unsafe blocks in crates/comenqd/src/config.rs that wrap calls to std::env::set_var and std::env::remove_var. These functions are safe in Rust and do not require unsafe blocks.

Problem

The unsafe blocks violate the coding guidelines which state "Avoid unsafe unless absolutely necessary."

Locations

  • Line 126: unsafe { std::env::set_var(key, val); }
  • Line 139: unsafe { std::env::set_var(&self.key, v) }
  • Line 140: unsafe { std::env::remove_var(&self.key) }
  • Line 146: unsafe { std::env::remove_var(key); }

Solution

Remove all unsafe blocks wrapping these environment variable function calls since they are safe functions.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions