Skip to content

Clippy Tracking Issue: clippy::case_sensitive_file_extension_comparisons (pedantic) #1737

Description

@makubacki

Documentation: clippy::case_sensitive_file_extension_comparisons

Current Status: There is a temporary allowance in read_filename() in patina_dxe_core/src/pecoff.rs that needs follow up to determine whether to allow insensitive extensions in that case or not:

    /// Parses a bytes buffer containing the filename.
    fn read_filename(bytes: &[u8]) -> error::Result<Option<String>> {
        let filename_end = bytes.iter().position(|&c| c == b'\0').unwrap_or(bytes.len());
        let mut filename = String::from_utf8_lossy(bytes.get(..filename_end).unwrap_or(bytes)).into_owned();

        #[allow(clippy::case_sensitive_file_extension_comparisons)]
        // TODO: Determine whether case insensitivity is required here.
        if filename.ends_with(".pdb") || filename.ends_with(".dll") {
            filename.truncate(filename.len() - 4);
        }

        if let Some(index) = filename.rfind(|ref c| ['/', '\\'].contains(c)) {
            filename.drain(..=index);
        }

        Ok(Some(format!("{filename}.efi")))
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions