File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use crate::cfg_flag::CfgFlag;
1313#[ derive( Clone , Debug , Eq , PartialEq ) ]
1414pub struct ProjectJson {
1515 pub ( crate ) sysroot_src : Option < AbsPathBuf > ,
16- project_root : Option < AbsPathBuf > ,
16+ project_root : AbsPathBuf ,
1717 crates : Vec < Crate > ,
1818}
1919
@@ -37,7 +37,7 @@ impl ProjectJson {
3737 pub fn new ( base : & AbsPath , data : ProjectJsonData ) -> ProjectJson {
3838 ProjectJson {
3939 sysroot_src : data. sysroot_src . map ( |it| base. join ( it) ) ,
40- project_root : base. parent ( ) . map ( AbsPath :: to_path_buf) ,
40+ project_root : base. to_path_buf ( ) ,
4141 crates : data
4242 . crates
4343 . into_iter ( )
@@ -91,11 +91,8 @@ impl ProjectJson {
9191 pub fn crates ( & self ) -> impl Iterator < Item = ( CrateId , & Crate ) > + ' _ {
9292 self . crates . iter ( ) . enumerate ( ) . map ( |( idx, krate) | ( CrateId ( idx as u32 ) , krate) )
9393 }
94- pub fn path ( & self ) -> Option < & AbsPath > {
95- match & self . project_root {
96- Some ( p) => Some ( p. as_path ( ) ) ,
97- None => None ,
98- }
94+ pub fn path ( & self ) -> & AbsPath {
95+ & self . project_root
9996 }
10097}
10198
Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ impl GlobalState {
249249 // Enable flychecks for json projects if a custom flycheck command was supplied
250250 // in the workspace configuration.
251251 match config {
252- FlycheckConfig :: CustomCommand { .. } => project. path ( ) ,
252+ FlycheckConfig :: CustomCommand { .. } => Some ( project. path ( ) ) ,
253253 _ => None ,
254254 }
255255 }
You can’t perform that action at this time.
0 commit comments