Skip to content

Commit

Permalink
fix: clippy error when not on unix (#4000)
Browse files Browse the repository at this point in the history
Description
---
- fixes clippy error when not on unix

Motivation and Context
---
imports should be gated for #[cfg(target_family = "unix")]

How Has This Been Tested?
---
CI passes

cargo lints clippy --all-targets passes on clippy-lockdown branch
  • Loading branch information
sdbondi committed Apr 5, 2022
1 parent 9279de5 commit 7e38259
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions applications/tari_app_utilities/src/identity_management.rs
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::{clone::Clone, fs, io, os, path::Path, sync::Arc};
use std::{clone::Clone, fs, io, path::Path, sync::Arc};

use log::*;
use rand::rngs::OsRng;
Expand Down Expand Up @@ -234,7 +234,7 @@ fn check_identity_file<P: AsRef<Path>>(path: P) -> Result<(), IdentityError> {

#[cfg(target_family = "unix")]
fn set_permissions<P: AsRef<Path>>(path: P, new_perms: u32) -> io::Result<()> {
use os::unix::fs::PermissionsExt;
use std::os::unix::fs::PermissionsExt;
let metadata = fs::metadata(&path)?;
let mut perms = metadata.permissions();
perms.set_mode(new_perms);
Expand All @@ -250,7 +250,7 @@ fn set_permissions<P: AsRef<Path>>(_: P, _: u32) -> io::Result<()> {

#[cfg(target_family = "unix")]
fn has_permissions<P: AsRef<Path>>(path: P, perms: u32) -> io::Result<bool> {
use os::unix::fs::PermissionsExt;
use std::os::unix::fs::PermissionsExt;
let metadata = fs::metadata(path)?;
Ok(metadata.permissions().mode() == perms)
}
Expand Down

0 comments on commit 7e38259

Please sign in to comment.