fn should_decompress(enabled: bool, filename: &str) -> (bool, &str) {
    // Only decompress if a recognized compression suffix exists.  This
    // avoids trying to decompress files where the compression is an
    // inherent part of the file format.  In particular, it avoids
    // corrupting non-x86_64 PXE initramfs images by truncating off the
    // appended cpio archive, or decompressing aarch64 kernels.

    #[allow(clippy::if_same_then_else)] // readability
    if !enabled {
        (false, filename)
    } else if filename.ends_with(".tar.gz") || filename.ends_with(".tar.xz") {
        // In general, an uncompressed .tar file isn't especially useful,
        // since we've only done half the decoding.  In particular, GCP
        // images are .tar.gz but are not intended to be unpacked; GCP will
        // not accept a bare .tar file.
        (false, filename)
    } else if filename.ends_with(".gz") {
        (true, filename.trim_end_matches(".gz"))
    } else if filename.ends_with(".xz") {
        (true, filename.trim_end_matches(".xz"))
    } else {
        (false, filename)
    }
}
/// Take the value of the command-line compression option and the remote
/// filename and decide whether we should actually decompress and to what
/// output filename.
Take the value of the command-line compression option and the remote
filename and decide whether we should actually decompress and to what
output filename.
Take the value of the command - line compression option and the remote filename and decide whether we should actually decompress and to what output filename .
fn should_decompress(enabled: bool, filename: &str) -> (bool, &str) {
    // Only decompress if a recognized compression suffix exists.  This
    // avoids trying to decompress files where the compression is an
    // inherent part of the file format.  In particular, it avoids
    // corrupting non-x86_64 PXE initramfs images by truncating off the
    // appended cpio archive, or decompressing aarch64 kernels.
    #[allow(clippy::if_same_then_else)] // readability
    if !enabled {
        (false, filename)
    } else if filename.ends_with(".tar.gz") || filename.ends_with(".tar.xz") {
        // In general, an uncompressed .tar file isn't especially useful,
        // since we've only done half the decoding.  In particular, GCP
        // images are .tar.gz but are not intended to be unpacked; GCP will
        // not accept a bare .tar file.
        (false, filename)
    } else if filename.ends_with(".gz") {
        (true, filename.trim_end_matches(".gz"))
    } else if filename.ends_with(".xz") {
        (true, filename.trim_end_matches(".xz"))
    } else {
        (false, filename)
    }
}
fn should_decompress ( enabled : bool , filename : & str ) -> ( bool , & str ) { // Only decompress if a recognized compression suffix exists.  This // avoids trying to decompress files where the compression is an // inherent part of the file format.  In particular, it avoids // corrupting non-x86_64 PXE initramfs images by truncating off the // appended cpio archive, or decompressing aarch64 kernels. # [ allow ( clippy if_same_then_else ) ] // readability if ! enabled { ( false , filename ) } else if filename . ends_with ( " " ) || filename . ends_with ( " " ) { // In general, an uncompressed .tar file isn't especially useful, // since we've only done half the decoding.  In particular, GCP // images are .tar.gz but are not intended to be unpacked; GCP will // not accept a bare .tar file. ( false , filename ) } else if filename . ends_with ( " " ) { ( true , filename . trim_end_matches ( " " ) ) } else if filename . ends_with ( " " ) { ( true , filename . trim_end_matches ( " " ) ) } else { ( false , filename ) } }
Take the value of the command-line compression option and the remote
filename and decide whether we should actually decompress and to what
output filename.
Take the value of the command - line compression option and the remote filename and decide whether we should actually decompress and to what output filename .
enabled
bool
filename
&str
enabled
bool
filename
&str