ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

enable workspace level clippy

+41 -35
+8
Cargo.toml
··· 7 7 [workspace.metadata.crane] 8 8 name = "wire" 9 9 10 + [workspace.lints.clippy] 11 + pedantic = { level = "deny", priority = -1 } 12 + missing_const_for_fn = "deny" 13 + 14 + # annoying to deal with 15 + missing_errors_doc = "allow" 16 + missing_panics_doc = "allow" 17 + 10 18 [workspace.dependencies] 11 19 futures-util = { version = "0.3.31", features = ["sink", "std"] } 12 20 clap = { version = "4.5.50", features = ["derive", "string", "cargo"] }
+3
wire/cli/Cargo.toml
··· 3 3 version.workspace = true 4 4 edition.workspace = true 5 5 6 + [lints] 7 + workspace = true 8 + 6 9 [features] 7 10 dhat-heap = [] 8 11
-2
wire/cli/src/main.rs
··· 1 1 // SPDX-License-Identifier: AGPL-3.0-or-later 2 2 // Copyright 2024-2025 wire Contributors 3 3 4 - #![deny(clippy::pedantic)] 5 - #![allow(clippy::missing_panics_doc)] 6 4 use std::process::Command; 7 5 8 6 use crate::cli::Cli;
+2 -2
wire/cli/src/tracing_setup.rs
··· 119 119 } 120 120 } 121 121 122 - fn get_style(level: Level) -> Style { 122 + const fn get_style(level: Level) -> Style { 123 123 let mut style = Style::new(); 124 124 125 125 style = match level { ··· 133 133 style 134 134 } 135 135 136 - fn fmt_level(level: Level) -> &'static str { 136 + const fn fmt_level(level: Level) -> &'static str { 137 137 match level { 138 138 Level::TRACE => "TRACE", 139 139 Level::DEBUG => "DEBUG",
+3
wire/lib/Cargo.toml
··· 3 3 version.workspace = true 4 4 edition.workspace = true 5 5 6 + [lints] 7 + workspace = true 8 + 6 9 [features] 7 10 no_web_tests = [] 8 11
+13 -15
wire/lib/build.rs
··· 2 2 // Copyright 2024-2025 wire Contributors 3 3 4 4 use miette::{Context, IntoDiagnostic as _, Result, miette}; 5 + use std::fmt::Write; 5 6 use std::{ 6 7 env, 7 8 fmt::{self, Display, Formatter}, ··· 45 46 {help} 46 47 :::" 47 48 ), 48 - None => "".to_string(), 49 + None => String::new(), 49 50 }, 50 51 message = match &self.message { 51 52 Some(message) => format!( ··· 54 55 {message} 55 56 ```" 56 57 ), 57 - None => "".to_string(), 58 + None => String::new(), 58 59 } 59 60 ) 60 61 } ··· 70 71 list.tokens 71 72 .clone() 72 73 .into_iter() 73 - .filter(|tok| matches!(tok, TokenTree::Literal(tok) if tok.to_string().starts_with("\""))) 74 + .filter(|tok| matches!(tok, TokenTree::Literal(tok) if tok.to_string().starts_with('"'))) 74 75 .map(|tok| tok.to_string()) 75 76 .join(""), 76 77 ); ··· 91 92 matches!(ident, TokenTree::Ident(ident) if ident == "code") 92 93 && matches!(group, TokenTree::Group(..)) 93 94 }) { 94 - Some(group.stream().to_string().replace(" ", "")) 95 + Some(group.stream().to_string().replace(' ', "")) 95 96 } else { 96 97 None 97 98 }; ··· 116 117 Err(miette!("Had no code.")) 117 118 } 118 119 119 - fn update_from_list(&mut self, list: MetaList) { 120 - let _ = self.get_error(&list); 121 - let _ = self.update_diagnostic(&list); 120 + fn update_from_list(&mut self, list: &MetaList) { 121 + let _ = self.get_error(list); 122 + let _ = self.update_diagnostic(list); 122 123 } 123 124 124 125 fn update_from_namevalue(&mut self, list: MetaNameValue) -> Result<(), miette::Error> { ··· 129 130 if let Expr::Lit(lit) = list.value 130 131 && let Lit::Str(str) = lit.lit 131 132 { 132 - self.doc_string 133 - .push_str(&format!("{}\n\n", &str.value()[1..])); 133 + let _ = write!(self.doc_string, "{}\n\n", &str.value()[1..]); 134 134 } 135 135 136 136 Ok(()) ··· 141 141 println!("cargo:rerun-if-changed=src/errors.rs"); 142 142 143 143 let manifest_dir = env::var("CARGO_MANIFEST_DIR").into_diagnostic()?; 144 - let md_out_dir = if let Ok(path) = env::var("DIAGNOSTICS_MD_OUTPUT") { 145 - path 146 - } else { 144 + let Ok(md_out_dir) = env::var("DIAGNOSTICS_MD_OUTPUT") else { 147 145 return Ok(()); 148 146 }; 149 147 ··· 170 168 for attribute in variant.attrs.clone() { 171 169 match attribute.meta { 172 170 Meta::List(list) => { 173 - entry.update_from_list(list); 171 + entry.update_from_list(&list); 174 172 } 175 173 Meta::NameValue(nv) => { 176 174 let _ = entry.update_from_namevalue(nv); 177 175 } 178 - _ => {} 176 + Meta::Path(_) => {} 179 177 } 180 178 } 181 179 ··· 191 189 .wrap_err("creating target directory")?; 192 190 fs::write( 193 191 Path::new(&md_out_dir).join("DIAGNOSTICS.md"), 194 - entries.iter().map(|x| x.to_string()).join("\n\n"), 192 + entries.iter().map(std::string::ToString::to_string).join("\n\n"), 195 193 ) 196 194 .into_diagnostic() 197 195 .wrap_err("writing DIAGNOSTICS.md")?;
+1 -1
wire/lib/src/commands/interactive.rs
··· 288 288 } 289 289 290 290 impl CompletionStatus { 291 - fn new() -> Self { 291 + const fn new() -> Self { 292 292 CompletionStatus { 293 293 completed: Mutex::new(false), 294 294 success: Mutex::new(None),
+1 -1
wire/lib/src/commands/interactive_logbuffer.rs
··· 7 7 } 8 8 9 9 impl LogBuffer { 10 - pub fn new() -> Self { 10 + pub const fn new() -> Self { 11 11 Self { buffer: Vec::new() } 12 12 } 13 13
+6 -6
wire/lib/src/commands/mod.rs
··· 56 56 }); 57 57 58 58 impl<'a, S: AsRef<str>> CommandArguments<'a, S> { 59 - pub(crate) fn new(command_string: S, modifiers: SubCommandModifiers) -> Self { 59 + pub(crate) const fn new(command_string: S, modifiers: SubCommandModifiers) -> Self { 60 60 Self { 61 61 command_string, 62 62 keep_stdin_open: false, ··· 68 68 } 69 69 } 70 70 71 - pub(crate) fn on_target(mut self, target: Option<&'a Target>) -> Self { 71 + pub(crate) const fn on_target(mut self, target: Option<&'a Target>) -> Self { 72 72 self.target = target; 73 73 self 74 74 } 75 75 76 - pub(crate) fn nix(mut self) -> Self { 76 + pub(crate) const fn nix(mut self) -> Self { 77 77 self.output_mode = ChildOutputMode::Nix; 78 78 self 79 79 } 80 80 81 - pub(crate) fn keep_stdin_open(mut self) -> Self { 81 + pub(crate) const fn keep_stdin_open(mut self) -> Self { 82 82 self.keep_stdin_open = true; 83 83 self 84 84 } 85 85 86 - pub(crate) fn elevated(mut self) -> Self { 86 + pub(crate) const fn elevated(mut self) -> Self { 87 87 self.elevated = true; 88 88 self 89 89 } 90 90 91 - pub(crate) fn log_stdout(mut self) -> Self { 91 + pub(crate) const fn log_stdout(mut self) -> Self { 92 92 self.log_stdout = true; 93 93 self 94 94 }
+3 -1
wire/lib/src/hive/node.rs
··· 157 157 .ok_or(HiveLibError::NetworkError(NetworkError::HostsExhausted)) 158 158 } 159 159 160 - pub fn host_failed(&mut self) { 160 + pub const fn host_failed(&mut self) { 161 161 self.current_host += 1; 162 162 } 163 163 ··· 257 257 } 258 258 } 259 259 260 + #[must_use] 260 261 pub fn should_apply_locally(allow_local_deployment: bool, name: &str) -> bool { 261 262 *name == *gethostname() && allow_local_deployment 262 263 } ··· 355 356 } 356 357 357 358 impl<'a> GoalExecutor<'a> { 359 + #[must_use] 358 360 pub fn new(context: Context<'a>) -> Self { 359 361 Self { 360 362 steps: vec![
+1 -1
wire/lib/src/hive/steps/activate.rs
··· 21 21 } 22 22 } 23 23 24 - pub async fn wait_for_ping(ctx: &Context<'_>) -> Result<(), HiveLibError> { 24 + async fn wait_for_ping(ctx: &Context<'_>) -> Result<(), HiveLibError> { 25 25 let host = ctx.node.target.get_preferred_host()?; 26 26 let mut result = ctx.node.ping(ctx.modifiers).await; 27 27
-6
wire/lib/src/lib.rs
··· 1 1 // SPDX-License-Identifier: AGPL-3.0-or-later 2 2 // Copyright 2024-2025 wire Contributors 3 3 4 - #![deny(clippy::pedantic)] 5 - #![allow( 6 - clippy::missing_errors_doc, 7 - clippy::must_use_candidate, 8 - clippy::missing_panics_doc 9 - )] 10 4 #![feature(assert_matches)] 11 5 #![feature(iter_intersperse)] 12 6