unused-pub 0.1.3

A tool to detect unused public items (structs, enums, functions, etc.) in a Rust codebase.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::Result;
use std::path::{Path, PathBuf};
use walkdir::WalkDir;

pub fn get_rust_files(path: &Path) -> Result<Vec<PathBuf>> {
    let mut files = Vec::new();
    for entry in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) {
        let path = entry.path();
        if path.is_file() {
            if let Some(ext) = path.extension() {
                if ext == "rs" {
                    files.push(path.to_path_buf());
                }
            }
        }
    }
    Ok(files)
}