]> git.lizzy.rs Git - rust.git/blob - crates/rust-analyzer/src/cli/symbols.rs
Replaced fold with for loop
[rust.git] / crates / rust-analyzer / src / cli / symbols.rs
1 //! Read Rust code on stdin, print syntax tree on stdout.
2 use ide::Analysis;
3
4 use crate::cli::{flags, read_stdin};
5
6 impl flags::Symbols {
7     pub fn run(self) -> anyhow::Result<()> {
8         let text = read_stdin()?;
9         let (analysis, file_id) = Analysis::from_single_file(text);
10         let structure = analysis.file_structure(file_id).unwrap();
11         for s in structure {
12             println!("{:?}", s);
13         }
14         Ok(())
15     }
16 }