Skip to content

Commit def6661

Browse files
committed
style: format
Signed-off-by: Alan Wandke <[email protected]>
1 parent ce6373d commit def6661

31 files changed

+63
-58
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# You can override the included template(s) by including variable overrides
23
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
34
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings

.mega-linter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Configuration file for MegaLinter
23
# See all available variables at https://oxsecurity.github.io/megalinter/configuration/
34
# and in linters documentation

bpf/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn generate_header_bindings(hdr_file: &Path, out_path: &Path) -> Result<PathBuf>
127127
let mut out_file = out_path.join(
128128
hdr_file
129129
.file_stem()
130-
.context(format!("Header path has no stem: {:?}", hdr_file))?,
130+
.context(format!("Header path has no stem: {hdr_file:?}"))?,
131131
);
132132
out_file.set_extension("rs");
133133
let hdr_file_str = hdr_file.to_string_lossy();

bpf/src/logging/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ pub fn log_header(data: &[u8]) -> Option<&log_hdr> {
212212
} else {
213213
log(
214214
LogLevel::LOG_LEVEL_ERROR,
215-
format!("(unable to parse log header) {:?}", data),
215+
format!("(unable to parse log header) {data:?}"),
216216
);
217217
None
218218
}
@@ -242,7 +242,7 @@ impl std::fmt::Display for generic_msg_log {
242242
/// Formats a log from the sb_umount BPF program
243243
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
244244
let msg = char_array_to_str(&self.msg);
245-
write!(f, "{}", msg)
245+
write!(f, "{msg}")
246246
}
247247
}
248248

@@ -306,6 +306,6 @@ impl std::fmt::Display for ptrace_access_check_log {
306306
impl std::fmt::Display for inode_access_log {
307307
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
308308
let name = char_array_to_str(&self.name);
309-
write!(f, "access to {}", name)
309+
write!(f, "access to {name}")
310310
}
311311
}

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
site_name: eBPF Security
23
site_url: !ENV [SITE_URL]
34
repo_name: !ENV [REPO_NAME]

docs/tools/seabee-autocast-demo.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
settings:
23
width: 80
34
height: 24

seabee/src/policy/runtime_update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl super::SeaBeePolicy {
137137
return Err(anyhow!("Policy update succeeded, but error occurred while updating files on disk.\nChanges will not persist after reboot. Issuing another successful policy update would resolve the issue.\n{e}"));
138138
}
139139

140-
Ok(format!("Success!\n{}", new_policy))
140+
Ok(format!("Success!\n{new_policy}"))
141141
}
142142

143143
/// add a new policy to SeaBee and to the kernel, but does not save to disk

seabee/src/seabeectl_lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ impl std::fmt::Display for SocketCommand {
140140
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
141141
match self {
142142
SocketCommand::List => write!(f, "List"),
143-
SocketCommand::Show(ident) => write!(f, "Show: {}", ident),
143+
SocketCommand::Show(ident) => write!(f, "Show: {ident}"),
144144
SocketCommand::Update(update_info) => {
145145
write!(f, "Update: {}", update_info.target_path.display())
146146
}
147147
SocketCommand::Remove(remove_info) => {
148148
write!(f, "Remove: {}", remove_info.target_path.display())
149149
}
150150
SocketCommand::ListKeys => write!(f, "Keylist"),
151-
SocketCommand::ShowKey(ident) => write!(f, "Show Key: {}", ident),
151+
SocketCommand::ShowKey(ident) => write!(f, "Show Key: {ident}"),
152152
SocketCommand::AddKey(key_info) => {
153153
write!(f, "Add Key: {}", key_info.target_path.display())
154154
}
@@ -171,7 +171,7 @@ pub enum KeyIdentifier {
171171
impl std::fmt::Display for KeyIdentifier {
172172
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
173173
match self {
174-
KeyIdentifier::Id { id } => write!(f, "Id: {}", id),
174+
KeyIdentifier::Id { id } => write!(f, "Id: {id}"),
175175
KeyIdentifier::File { path } => write!(f, "File: {}", path.display()),
176176
}
177177
}
@@ -198,8 +198,8 @@ impl Default for ObjIdentifier {
198198
impl std::fmt::Display for ObjIdentifier {
199199
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
200200
match self {
201-
ObjIdentifier::Id { id } => write!(f, "Id: {}", id),
202-
ObjIdentifier::Name { name } => write!(f, "Name: {}", name),
201+
ObjIdentifier::Id { id } => write!(f, "Id: {id}"),
202+
ObjIdentifier::Name { name } => write!(f, "Name: {name}"),
203203
ObjIdentifier::File { path } => write!(f, "File: {}", path.display()),
204204
}
205205
}
@@ -230,7 +230,7 @@ pub fn execute_socket_command(command: SocketCommand) -> Result<()> {
230230
if response.contains("Error executing command:") {
231231
return Err(anyhow!("{}", response));
232232
}
233-
println!("{}", response);
233+
println!("{response}");
234234

235235
Ok(())
236236
}
@@ -245,7 +245,7 @@ pub fn execute_local_command(cmd: LocalCommand) -> Result<()> {
245245
LocalCommand::Config(subcmd) => seabeectl_config(subcmd)?,
246246
};
247247

248-
println!("{}", output);
248+
println!("{output}");
249249
Ok(())
250250
}
251251

tests/configs/sample_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# This is the default config file
23
# This configuration is our secure configuration for production use.
34
# This configuration file will include a default setting for every configuraiton option.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
---
12
verify_policy: false

0 commit comments

Comments
 (0)