Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/metrics/fn_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ use crate::*;
/// of a function/method.
#[derive(Debug, Clone)]
pub struct Stats {
n_args: usize,
nargs: usize,
}

impl Default for Stats {
fn default() -> Self {
Self { n_args: 0 }
Self { nargs: 0 }
}
}

Expand All @@ -25,13 +25,13 @@ impl Serialize for Stats {
where
S: Serializer,
{
serializer.serialize_f64(self.n_args())
serializer.serialize_f64(self.nargs())
}
}

impl fmt::Display for Stats {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.n_args)
write!(f, "{}", self.nargs())
}
}

Expand All @@ -40,8 +40,8 @@ impl Stats {
pub fn merge(&mut self, _other: &Stats) {}

/// Returns the `NArgs` metric value
pub fn n_args(&self) -> f64 {
self.n_args as f64
pub fn nargs(&self) -> f64 {
self.nargs as f64
}
}

Expand All @@ -59,7 +59,7 @@ where
let node_params = Node::new(params);
node_params.act_on_child(&mut |n| {
if !Self::is_non_arg(n) {
stats.n_args += 1;
stats.nargs += 1;
}
});
}
Expand All @@ -77,7 +77,7 @@ impl NArgs for CppCode {
let node_params = Node::new(params);
node_params.act_on_child(&mut |n| {
if !Self::is_non_arg(n) {
stats.n_args += 1;
stats.nargs += 1;
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/output/dump_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ fn dump_nargs(
write!(stdout, "{}{}", prefix, pref)?;

color!(stdout, Green, true);
write!(stdout, "n_args: ")?;
write!(stdout, "nargs: ")?;

color!(stdout, White);
writeln!(stdout, "{}", stats.n_args())
writeln!(stdout, "{}", stats.nargs())
}

fn dump_nexits(
Expand All @@ -282,7 +282,7 @@ fn dump_nexits(
write!(stdout, "{}{}", prefix, pref)?;

color!(stdout, Green, true);
write!(stdout, "n_exits: ")?;
write!(stdout, "nexits: ")?;

color!(stdout, White);
writeln!(stdout, "{}", stats.exit())
Expand Down