ls: silence clippy warnings if feat_selinx is not set
@@ -1259,7 +1259,11 @@ impl PathData {
None => OnceCell::new(),
};
- let security_context = get_security_context(config, &p_buf, must_dereference);
+ let security_context = if config.context {
+ get_security_context(config, &p_buf, must_dereference)
+ } else {
+ String::new()
+ };
Self {
md: OnceCell::new(),
@@ -2089,9 +2093,9 @@ fn display_symlink_count(metadata: &Metadata) -> String {
// This returns the SELinux security context as UTF8 `String`.
// In the long term this should be changed to `OsStr`, see discussions at #2621/#2656
-fn get_security_context(config: &Config, p_buf: &PathBuf, must_dereference: bool) -> String {
+#[allow(unused_variables)]
+fn get_security_context(config: &Config, p_buf: &Path, must_dereference: bool) -> String {
let substitute_string = "?".to_string();
- if config.context {
if config.selinux_supported {
#[cfg(feature = "selinux")]
{
@@ -2126,7 +2130,4 @@ fn get_security_context(config: &Config, p_buf: &PathBuf, must_dereference: bool
} else {
substitute_string
}
- } else {
- String::new()
- }
}
