@@ -14,15 +14,15 @@ use crate::exit::{self, Exit};
1414use crate :: fn_args:: { self , NArgs } ;
1515use crate :: getter:: Getter ;
1616use crate :: halstead:: { self , Halstead } ;
17- use crate :: sloc :: { self , SourceLoc } ;
17+ use crate :: loc :: { self , Loc } ;
1818use crate :: tools:: write_file;
1919use crate :: traits:: * ;
2020
2121#[ derive( Debug ) ]
2222pub struct CodeMetrics < ' a > {
2323 pub cyclomatic : cyclomatic:: Stats ,
2424 pub halstead : halstead:: Stats < ' a > ,
25- pub sloc : sloc :: Stats ,
25+ pub loc : loc :: Stats ,
2626 pub nargs : fn_args:: Stats ,
2727 pub nexits : exit:: Stats ,
2828}
@@ -35,7 +35,7 @@ impl<'a> Serialize for CodeMetrics<'a> {
3535 let mut st = serializer. serialize_struct ( "metrics" , 3 ) ?;
3636 st. serialize_field ( "cyclomatic" , & self . cyclomatic ) ?;
3737 st. serialize_field ( "halstead" , & self . halstead ) ?;
38- st. serialize_field ( "loc" , & self . sloc ) ?;
38+ st. serialize_field ( "loc" , & self . loc ) ?;
3939 st. serialize_field ( "nargs" , & self . nargs ) ?;
4040 st. serialize_field ( "nexits" , & self . nexits ) ?;
4141 st. end ( )
@@ -47,7 +47,7 @@ impl<'a> Default for CodeMetrics<'a> {
4747 Self {
4848 cyclomatic : cyclomatic:: Stats :: default ( ) ,
4949 halstead : halstead:: Stats :: default ( ) ,
50- sloc : sloc :: Stats :: default ( ) ,
50+ loc : loc :: Stats :: default ( ) ,
5151 nargs : fn_args:: Stats :: default ( ) ,
5252 nexits : exit:: Stats :: default ( ) ,
5353 }
@@ -58,7 +58,7 @@ impl<'a> fmt::Display for CodeMetrics<'a> {
5858 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
5959 writeln ! ( f, "{}" , self . cyclomatic) ?;
6060 writeln ! ( f, "{}" , self . halstead) ?;
61- writeln ! ( f, "{}" , self . sloc ) ?;
61+ writeln ! ( f, "{}" , self . loc ) ?;
6262 writeln ! ( f, "{}" , self . nargs) ?;
6363 write ! ( f, "{}" , self . nexits)
6464 }
@@ -68,7 +68,7 @@ impl<'a> CodeMetrics<'a> {
6868 pub fn merge ( & mut self , other : & CodeMetrics < ' a > ) {
6969 self . cyclomatic . merge ( & other. cyclomatic ) ;
7070 self . halstead . merge ( & other. halstead ) ;
71- self . sloc . merge ( & other. sloc ) ;
71+ self . loc . merge ( & other. loc ) ;
7272 self . nargs . merge ( & other. nargs ) ;
7373 self . nexits . merge ( & other. nexits ) ;
7474 }
@@ -183,7 +183,7 @@ impl<'a> FuncSpace<'a> {
183183 Self :: dump_nargs ( & metrics. nargs , & prefix, false , stdout) ?;
184184 Self :: dump_nexits ( & metrics. nexits , & prefix, false , stdout) ?;
185185 Self :: dump_halstead ( & metrics. halstead , & prefix, false , stdout) ?;
186- Self :: dump_sloc ( & metrics. sloc , & prefix, true , stdout)
186+ Self :: dump_loc ( & metrics. loc , & prefix, true , stdout)
187187 }
188188
189189 fn dump_cyclomatic (
@@ -245,8 +245,8 @@ impl<'a> FuncSpace<'a> {
245245 Self :: dump_value ( "bugs" , stats. bugs ( ) , & prefix, true , stdout)
246246 }
247247
248- fn dump_sloc (
249- stats : & sloc :: Stats ,
248+ fn dump_loc (
249+ stats : & loc :: Stats ,
250250 prefix : & str ,
251251 last : bool ,
252252 stdout : & mut StandardStreamLock ,
@@ -386,7 +386,7 @@ pub fn metrics<'a, T: TSParserTrait>(parser: &'a T, path: &'a PathBuf) -> Option
386386 if let Some ( last) = space_stack. last_mut ( ) {
387387 T :: Cyclomatic :: compute ( & node, & mut last. metrics . cyclomatic ) ;
388388 T :: Halstead :: compute ( & node, code, & mut last. metrics . halstead ) ;
389- T :: SourceLoc :: compute ( & node, code, & mut last. metrics . sloc , func_space, unit) ;
389+ T :: Loc :: compute ( & node, code, & mut last. metrics . loc , func_space, unit) ;
390390 T :: NArgs :: compute ( & node, & mut last. metrics . nargs ) ;
391391 T :: Exit :: compute ( & node, & mut last. metrics . nexits ) ;
392392 }
0 commit comments