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

Commit 127f396

Browse files
committed
rls-data: Simplify Analysis::new
1 parent 4cd3c08 commit 127f396

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

rls-data/src/lib.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use config::Config;
2828

2929
#[cfg_attr(feature = "serialize-serde", derive(Serialize, Deserialize))]
3030
#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
31-
#[derive(Debug, Clone)]
31+
#[derive(Debug, Clone, Default)]
3232
#[repr(C)]
3333
pub struct Analysis {
3434
/// The Config used to generate this analysis data.
@@ -45,18 +45,13 @@ pub struct Analysis {
4545
}
4646

4747
impl Analysis {
48+
/// Returns an initialized `Analysis` struct with `config` and also
49+
/// `version` field to Cargo package version.
4850
pub fn new(config: Config) -> Analysis {
4951
Analysis {
5052
config,
5153
version: option_env!("CARGO_PKG_VERSION").map(ToString::to_string),
52-
prelude: None,
53-
compilation: None,
54-
imports: vec![],
55-
defs: vec![],
56-
impls: vec![],
57-
refs: vec![],
58-
macro_refs: vec![],
59-
relations: vec![],
54+
..Analysis::default()
6055
}
6156
}
6257
}

0 commit comments

Comments
 (0)