Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 0384629

Browse files
fixup! Dump pkg version & build date & commit hash if run with --version flag.
1 parent c3d99ad commit 0384629

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/main.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,19 @@ type Span = span::Span<span::ZeroIndexed>;
5151
pub fn main() {
5252
env_logger::init().unwrap();
5353

54-
let args: Vec<String> = ::std::env::args().collect();
55-
if args[1] == "--version" || args[1] == "-V" {
56-
println!("rls {}", version());
54+
if let Some(first_arg) = ::std::env::args().skip(1).next() {
55+
match first_arg.as_str() {
56+
"--version" | "-V" => println!("rls {}", version()),
57+
_ => cmd::run(),
58+
}
5759
return;
5860
}
5961

60-
if args.len() > 1 {
61-
cmd::run();
62-
} else {
63-
let analysis = Arc::new(analysis::AnalysisHost::new(analysis::Target::Debug));
64-
let vfs = Arc::new(vfs::Vfs::new());
65-
let build_queue = Arc::new(build::BuildQueue::new(vfs.clone()));
62+
let analysis = Arc::new(analysis::AnalysisHost::new(analysis::Target::Debug));
63+
let vfs = Arc::new(vfs::Vfs::new());
64+
let build_queue = Arc::new(build::BuildQueue::new(vfs.clone()));
6665

67-
server::run_server(analysis, vfs, build_queue);
68-
}
66+
server::run_server(analysis, vfs, build_queue);
6967
}
7068

7169
fn version() -> &'static str {

0 commit comments

Comments
 (0)