Skip to content

Commit a376fe7

Browse files
committed
Run fmt and clippy
1 parent 4a556b6 commit a376fe7

File tree

4 files changed

+13
-27
lines changed

4 files changed

+13
-27
lines changed

compiler/plc_driver/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use std::{
1919

2020
use cli::{CompileParameters, ParameterError, SubCommands};
2121
use plc::{
22-
codegen::CodegenContext, linker::LinkerType, output::FormatOption, DebugLevel, ErrorFormat,
23-
OnlineChange, OptimizationLevel, Target, Threads,
22+
codegen::CodegenContext, linker::LinkerType, output::FormatOption, DebugLevel, ErrorFormat, OnlineChange,
23+
OptimizationLevel, Target, Threads,
2424
};
2525

2626
use plc_diagnostics::{diagnostician::Diagnostician, diagnostics::Diagnostic};
@@ -179,7 +179,10 @@ pub fn get_compilation_context<T: AsRef<str> + AsRef<OsStr> + Debug>(
179179
debug_level: compile_parameters.debug_level(),
180180
single_module: compile_parameters.single_module,
181181
online_change: if compile_parameters.online_change {
182-
OnlineChange::Enabled((compile_parameters.got_layout_file.clone(),compile_parameters.got_layout_format()))
182+
OnlineChange::Enabled((
183+
compile_parameters.got_layout_file.clone(),
184+
compile_parameters.got_layout_format(),
185+
))
183186
} else {
184187
OnlineChange::Disabled
185188
},

src/codegen.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,7 @@ impl<'ink> CodeGen<'ink> {
102102
let module = context.create_module(module_location);
103103
module.set_source_file_name(module_location);
104104
let debug = debug::DebugBuilderEnum::new(context, &module, root, optimization_level, debug_level);
105-
CodeGen {
106-
module,
107-
debug,
108-
module_location: module_location.to_string(),
109-
online_change,
110-
}
105+
CodeGen { module, debug, module_location: module_location.to_string(), online_change }
111106
}
112107

113108
pub fn generate_llvm_index(
@@ -131,14 +126,8 @@ impl<'ink> CodeGen<'ink> {
131126
)?;
132127
index.merge(llvm_type_index);
133128

134-
let mut variable_generator = VariableGenerator::new(
135-
&self.module,
136-
&llvm,
137-
global_index,
138-
annotations,
139-
&index,
140-
&mut self.debug,
141-
);
129+
let mut variable_generator =
130+
VariableGenerator::new(&self.module, &llvm, global_index, annotations, &index, &mut self.debug);
142131

143132
//Generate global variables
144133
let llvm_gv_index =
@@ -177,8 +166,7 @@ impl<'ink> CodeGen<'ink> {
177166
acc
178167
});
179168

180-
181-
if let OnlineChange::Enabled((_,_)) = self.online_change {
169+
if let OnlineChange::Enabled((_, _)) = self.online_change {
182170
let got_entries = &mut *got_layout.lock().unwrap();
183171

184172
let mut new_symbols = Vec::new();

src/codegen/generators/pou_generator.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ pub struct PouGenerator<'ink, 'cg> {
5555

5656
/// Creates opaque implementations for all callable items in the index
5757
/// Returns a Typed index containing the associated implementations.
58+
/// FIXME: Ignoring the arguments warning for now, should refactor later to pass the options in a struct
59+
#[allow(clippy::too_many_arguments)]
5860
pub fn generate_implementation_stubs<'ink>(
5961
module: &Module<'ink>,
6062
llvm: Llvm<'ink>,

src/codegen/generators/variable_generator.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,7 @@ impl<'ctx, 'b> VariableGenerator<'ctx, 'b> {
4343
types_index: &'b LlvmTypedIndex<'ctx>,
4444
debug: &'b mut DebugBuilderEnum<'ctx>,
4545
) -> Self {
46-
VariableGenerator {
47-
module,
48-
llvm,
49-
global_index,
50-
annotations,
51-
types_index,
52-
debug,
53-
}
46+
VariableGenerator { module, llvm, global_index, annotations, types_index, debug }
5447
}
5548

5649
pub fn generate_global_variables(

0 commit comments

Comments
 (0)