You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: linux.rs
    path of file: ./repos/bottom/src/data_collection/temperature
    
    the code of the file until where you have to start completion: //! Gets temperature sensor data for Linux platforms.

use std::{
    fs,
    path::{Path, PathBuf},
};

use anyhow::Result;
use hashbrown::{HashMap, HashSet};

use super::{is_temp_filtered, TempHarvest, TemperatureType};
use crate::{app::filter::Filter, utils::error::BottomError};

const EMPTY_NAME: &str = "Unknown";

/// Returned results from grabbing hwmon/coretemp temperature sensor values/names.
struct HwmonResults {
    temperatures: Vec<TempHarvest>,
    num_hwmon: usize,
}

/// Parses and reads temperatures that were in millidegree Celsius, and if successful, returns a temperature in Celsius.
fn parse_temp(path: &Path) -> Result<f32> {
    Ok(fs::read_to_string(path)?
        .trim_end()
        .parse::<f32>()
        .map_err(|e| BottomError::ConversionError(e.to_string()))?
        / 1_000.0)
}

/// Get all candidates from hwmon and coretemp. It will also return the number of entries from hwmon.
fn get_hwmon_candidates() -> (HashSet<PathBuf>, usize) {
    let mut dirs = HashSet::default();

    if let Ok(read_dir) = Path::new("/sys/class/hwmon").read_dir() {
        for entry in read_dir.flatten() {
            let mut path = entry.path();

            // hwmon includes many sensors, we only want ones with at least one temperature sensor
            // Reading this file will wake the device, but we're only checking existence, so it should be fine.
            if !path.join("temp1_input").exists() {
      
    
    fn test_finalize_name() {
        let mut seen_names = HashMap::new();

        assert_eq!(
            finalize_name(
                Some("hwmon".to_string()),
                Some("sensor".to_string()),
                &Some("test".to_string()),
                &mut seen_names
            ),
            "hwmon: sensor"
        );

        assert_eq!(
            finalize_name(
                Some("hwmon".to_string()),
                None,
                &Some("test".to_string()),
                &mut seen_names
            ),
            "hwmon"
        );

        assert_eq!(
            finalize_name(
                None,
                Some("sensor".to_string()),
                &Some("test".to_string()),
                &mut seen_names
            ),
            "test: sensor"
        );

        assert_eq!(
            finalize_name(
                Some("hwmon".to_string()),
                Some("sensor".to_string()),
                &Some("test".to_string()),
                &mut seen_names
            ),
            "hwmon: sensor (1)"
        );

        assert_eq!(
            finalize_name(None, None, &Some("test".to_string()), &mut seen_names),
            "test"
        );

        assert_eq!(finalize_name(None, None, &None, &mut seen_names), "Unknown");

        assert_eq!(
            finalize_name(None, None, &Some("test".to_string()), &mut seen_names),
            "test (1)"
        );

        assert_eq!(
            finalize_name(None, None, &None, &mut seen_names),
            "Unknown (1)"
        );

        assert_eq!(
            finalize_name(Some(String::default()), None, &None, &mut seen_names),
            "Unknown (2)"
        );

        assert_eq!(
            finalize_name(None, Some(String::default()), &None, &mut seen_names),
            "Unknown (3)"
        );

        assert_eq!(
            finalize_name(None, None, &Some(String::default()), &mut seen_names),
            "Unknown (4)"
        );
    }