Skip to content

Commit

Permalink
Resolve warning on Windows with system
Browse files Browse the repository at this point in the history
`cargo check --target=x86_64-pc-windows-msvc --no-default-features --features=system`

    warning: method `account_name` is never used
      --> src/windows/sid.rs:59:19
       |
    20 | impl Sid {
       | -------- method in this implementation
    ...
    59 |     pub(crate) fn account_name(&self) -> Option<String> {
       |                   ^^^^^^^^^^^^
       |
       = note: `#[warn(dead_code)]` on by default
  • Loading branch information
dtolnay committed Dec 7, 2024
1 parent 5a2df44 commit 687b768
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/windows/sid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
use std::{fmt::Display, str::FromStr};

use windows::core::{PCWSTR, PWSTR};
use windows::Win32::Foundation::{LocalFree, ERROR_INSUFFICIENT_BUFFER, HLOCAL, PSID};
#[cfg(feature = "user")]
use windows::Win32::Foundation::ERROR_INSUFFICIENT_BUFFER;
use windows::Win32::Foundation::{LocalFree, HLOCAL, PSID};
use windows::Win32::Security::Authorization::{ConvertSidToStringSidW, ConvertStringSidToSidW};
use windows::Win32::Security::{
CopySid, GetLengthSid, IsValidSid, LookupAccountSidW, SidTypeUnknown,
};
use windows::Win32::Security::{CopySid, GetLengthSid, IsValidSid};
#[cfg(feature = "user")]
use windows::Win32::Security::{LookupAccountSidW, SidTypeUnknown};

use crate::sys::utils::to_utf8_str;

Expand Down Expand Up @@ -56,6 +58,7 @@ impl Sid {
}

/// Retrieves the account name of this SID.
#[cfg(feature = "user")]
pub(crate) fn account_name(&self) -> Option<String> {
unsafe {
let mut name_len = 0;
Expand Down

0 comments on commit 687b768

Please sign in to comment.