[beginner] How to run different files other than main.rs

This file is not included anywhere in the module tree, so rust-analyzer can't offer IDE services.
If you're intentionally working on unowned files, you can silence this warning by adding
"unlinked-file" to rust-analyzer.diagnostics.disabled in your settings.rust-analyzerunlinked-file

how do i solve this error

quick fix in vs code states mod celcius; to use which leads to use it like this

mod celcius;

fn main() {
    println!("the celcius is {}",celcius::fan_to_cel(32.0));
}

if the file exports code like functions, macros, data structures, etc, you should use it as a "module", as suggested by vscode quickfix.

if the file is a separate program (a.k.a. binary crate), i.e. it contains a main() function, then you can put it under src/bin/ directory and it will be automatically recognized.

see