Skip to content

Commit 947e57a

Browse files
committed
rust: cosmetic changes in semantic module
1 parent f027e04 commit 947e57a

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

rust/bear/src/modes/semantic.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,19 @@ impl SemanticAnalysisPipeline {
3636
/// This implements the pipeline of the semantic analysis.
3737
pub(super) fn analyze_and_write(
3838
self,
39-
envelopes: impl IntoIterator<Item = Event>,
39+
events: impl IntoIterator<Item = Event>,
4040
) -> anyhow::Result<()> {
4141
// Set up the pipeline of compilation database entries.
42-
let entries = envelopes
42+
let semantics = events
4343
.into_iter()
4444
.inspect(|event| log::debug!("event: {}", event))
4545
.flat_map(|event| self.interpreter.recognize(&event.execution))
4646
.inspect(|semantic| log::debug!("semantic: {:?}", semantic))
47-
.flat_map(|semantic| self.transformation.apply(semantic));
47+
.flat_map(|semantic| self.transformation.apply(semantic))
48+
.inspect(|semantic| log::debug!("transformed: {:?}", semantic));
4849
// Consume the entries and write them to the output file.
4950
// The exit code is based on the result of the output writer.
50-
self.output_writer.run(entries)
51+
self.output_writer.run(semantics)
5152
}
5253
}
5354

@@ -61,13 +62,10 @@ pub(crate) enum OutputWriterImpl {
6162
}
6263

6364
impl OutputWriter for OutputWriterImpl {
64-
fn run(
65-
&self,
66-
compiler_calls: impl Iterator<Item = semantic::CompilerCall>,
67-
) -> anyhow::Result<()> {
65+
fn run(&self, semantics: impl Iterator<Item = semantic::CompilerCall>) -> anyhow::Result<()> {
6866
match self {
69-
OutputWriterImpl::Clang(writer) => writer.run(compiler_calls),
70-
OutputWriterImpl::Semantic(writer) => writer.run(compiler_calls),
67+
OutputWriterImpl::Clang(writer) => writer.run(semantics),
68+
OutputWriterImpl::Semantic(writer) => writer.run(semantics),
7169
}
7270
}
7371
}
@@ -109,13 +107,13 @@ pub(crate) struct SemanticOutputWriter {
109107
}
110108

111109
impl OutputWriter for SemanticOutputWriter {
112-
fn run(&self, entries: impl Iterator<Item = semantic::CompilerCall>) -> anyhow::Result<()> {
110+
fn run(&self, semantics: impl Iterator<Item = semantic::CompilerCall>) -> anyhow::Result<()> {
113111
let file_name = &self.output;
114112
let file = File::create(file_name)
115113
.map(BufWriter::new)
116114
.with_context(|| format!("Failed to create file: {:?}", file_name.as_path()))?;
117115

118-
semantic::serialize(file, entries)?;
116+
semantic::serialize(file, semantics)?;
119117

120118
Ok(())
121119
}

0 commit comments

Comments
 (0)