Skip to content

Commit

Permalink
Merge pull request #452 from primeos-work/cleanups
Browse files Browse the repository at this point in the history
Merge various smaller cleanups
  • Loading branch information
christophprokop authored Jan 16, 2025
2 parents e3b9d47 + 33dd23a commit 8d4d68f
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 18 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ indicatif = "0.17"
indoc = "2"
itertools = "0.14"
lazy_static = "1"
once_cell = "1"
parse-display = "0.10"
petgraph = "0.7"
pom = "3"
Expand Down
7 changes: 0 additions & 7 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,4 @@ ignore = [
# https://github.com/trishume/syntect/issues/537 is resolved (replace
# yaml-rust with yaml-rust2):
{ id = "RUSTSEC-2024-0320", reason = "Only an informative advisory that the crate is unmaintained and the maintainer unreachable" },

# Ignore an "INFO Unmaintained" advisory for the instant crate
# that the "indicatif" crate uses. This can be removed once
# https://github.com/console-rs/indicatif/issues/665 is resolved
# (The dependency instant is no longer maintained -
# consider switching to web-time instead):
{ id = "RUSTSEC-2024-0384", reason = "Only an informative advisory that the crate is unmaintained and the author recommends using the maintained web-time crate instead." },
]
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn cli() -> Command {
Command::new("butido")
.author(crate_authors!())
.disable_version_flag(true)
.about("Generic Build Orchestration System for building Linux packages with Docker")
.about("Generic build orchestration system for building Linux packages with Docker")
.after_help(indoc::indoc!(r#"
The following environment variables can be passed to butido:
Expand Down Expand Up @@ -246,7 +246,7 @@ pub fn cli() -> Command {
.required(true)
.index(1)
.value_name("SUBMIT")
.help("The Submit to show details about")
.help("The submit to show details about")
.value_parser(uuid::Uuid::parse_str)
)
)
Expand Down
2 changes: 1 addition & 1 deletion src/config/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// The default progress bar format
// Ignore a false positive Clippy warning (we pass this format string to
// `indicatif::ProgressBars` as `bar_template` instead of evaluating it here):
#[rustversion::attr(since(1.83), allow(clippy::literal_string_with_formatting_args))]
#[rustversion::attr(since(1.85), allow(clippy::literal_string_with_formatting_args))]
pub fn default_progress_format() -> String {
String::from("{elapsed_precise} {percent:>3}% {bar:5.cyan/blue} | {msg}")
}
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
while_true
)]
#![allow(macro_use_extern_crate)]
#![allow(unstable_name_collisions)] // TODO: Remove me with the next rustc update (probably)

#[macro_use]
extern crate diesel;
Expand Down
3 changes: 0 additions & 3 deletions src/package/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// SPDX-License-Identifier: EPL-2.0
//

// TODO: Is this really necessary?
#![allow(clippy::format_push_string)]

use std::process::ExitStatus;

use anyhow::anyhow;
Expand Down
8 changes: 5 additions & 3 deletions src/package/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use anyhow::anyhow;
use anyhow::Context;
use anyhow::Error;
use anyhow::Result;
use once_cell::sync::Lazy;
use pom::parser::Parser as PomParser;
use regex::Regex;
use serde::Deserialize;
Expand Down Expand Up @@ -170,7 +171,8 @@ impl TryInto<semver::Version> for PackageVersion {
// should be safe as long as the static regex guarantees the assumptions):
fn try_into(self) -> Result<semver::Version> {
// Warning: This regex must remain compatible to the one in the PackageVersion::parser below!:
let version_regex = Regex::new("^(?:([[:digit:]]+)|[-_.]|[[:alpha:]]+)").unwrap();
static VERSION_REGEX: Lazy<Regex> =
Lazy::new(|| Regex::new("^(?:([[:digit:]]+)|[-_.]|[[:alpha:]]+)").unwrap());
// This regex is based on PackageVersion::parser() below. We use a capture group to extract
// the numbers and the "(?:exp)" syntax is for a non-capturing group. If it matches we'll
// have the entire match in \0 and if it's a number it'll be in \1.
Expand All @@ -182,7 +184,7 @@ impl TryInto<semver::Version> for PackageVersion {

// This loop is dangerous... Ensure that the match gets removed from version_str in every
// iteration to avoid an endless loop!
while let Some(captures) = version_regex.captures(version_str) {
while let Some(captures) = VERSION_REGEX.captures(version_str) {
// For debugging: println!("{:?}", captures);

let match_str = captures.get(0).unwrap().as_str(); // Unwrap safe as \0 always exists
Expand Down Expand Up @@ -212,7 +214,7 @@ impl TryInto<semver::Version> for PackageVersion {
.with_context(|| {
anyhow!(
"The regex \"{}\" for parsing the PackageVersion didn't match",
version_regex
Lazy::force(&VERSION_REGEX)
)
})
.with_context(|| {
Expand Down

0 comments on commit 8d4d68f

Please sign in to comment.