refactor: switch to rust 2024 edition & handle dependency updates (#6609)

This commit is contained in:
David Knaack 2025-03-09 19:24:45 +01:00 committed by GitHub
parent df454d5a64
commit 2a3ca68457
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
48 changed files with 429 additions and 247 deletions

View File

@ -1265,6 +1265,7 @@
"Android": "🤖 ",
"Arch": "🎗️ ",
"Artix": "🎗️ ",
"Bluefin": "🐟 ",
"CachyOS": "🎗️ ",
"CentOS": "💠 ",
"Debian": "🌀 ",
@ -5008,6 +5009,7 @@
"Android": "🤖 ",
"Arch": "🎗️ ",
"Artix": "🎗️ ",
"Bluefin": "🐟 ",
"CachyOS": "🎗️ ",
"CentOS": "💠 ",
"Debian": "🌀 ",

167
Cargo.lock generated
View File

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "adler2"
@ -17,7 +17,7 @@ dependencies = [
"cfg-if",
"once_cell",
"version_check",
"zerocopy",
"zerocopy 0.7.35",
]
[[package]]
@ -627,7 +627,7 @@ checksum = "1c7397f8c48906dd9b5afc75001368c979418e5dff5575998a831eb2319b424e"
dependencies = [
"lazy_static",
"pathsearch",
"rand",
"rand 0.8.5",
"shared_library",
"termwiz",
"winapi",
@ -1873,9 +1873,9 @@ dependencies = [
[[package]]
name = "is_debug"
version = "1.0.2"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8ea828c9d6638a5bd3d8b14e37502b4d56cae910ccf8a5b7f51c7a0eb1d0508"
checksum = "1fe266d2e243c931d8190177f20bf7f24eed45e96f39e87dc49a27b32d12d407"
[[package]]
name = "is_terminal_polyfill"
@ -2469,7 +2469,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
dependencies = [
"phf_shared",
"rand",
"rand 0.8.5",
]
[[package]]
@ -2565,7 +2565,7 @@ version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [
"zerocopy",
"zerocopy 0.7.35",
]
[[package]]
@ -2676,8 +2676,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
]
[[package]]
name = "rand"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
dependencies = [
"rand_chacha 0.9.0",
"rand_core 0.9.3",
"zerocopy 0.8.22",
]
[[package]]
@ -2687,7 +2698,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
"rand_core 0.6.4",
]
[[package]]
name = "rand_chacha"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"rand_core 0.9.3",
]
[[package]]
@ -2699,6 +2720,15 @@ dependencies = [
"getrandom 0.2.15",
]
[[package]]
name = "rand_core"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
dependencies = [
"getrandom 0.3.1",
]
[[package]]
name = "rayon"
version = "1.10.0"
@ -3009,13 +3039,14 @@ dependencies = [
[[package]]
name = "shadow-rs"
version = "0.38.1"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ec14cc798c29f4bf74a6c4299c657c04d4e9fba03875c1f0eec569af03aed89"
checksum = "3672eb035a31ac62bf171765d04e3f1f01659920847384d08ac979ca6bb56763"
dependencies = [
"const_format",
"is_debug",
"time",
"tzdb",
]
[[package]]
@ -3126,7 +3157,7 @@ dependencies = [
"pest_derive",
"process_control",
"quick-xml 0.37.2",
"rand",
"rand 0.9.0",
"rayon",
"regex",
"rust-ini",
@ -3150,7 +3181,7 @@ dependencies = [
"versions",
"which",
"whoami",
"windows 0.59.0",
"windows 0.60.0",
"winres",
"yaml-rust2",
]
@ -3521,6 +3552,32 @@ version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "tz-rs"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1450bf2b99397e72070e7935c89facaa80092ac812502200375f1f7d33c71a1"
[[package]]
name = "tzdb"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0be2ea5956f295449f47c0b825c5e109022ff1a6a53bb4f77682a87c2341fbf5"
dependencies = [
"iana-time-zone",
"tz-rs",
"tzdb_data",
]
[[package]]
name = "tzdb_data"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0604b35c1f390a774fdb138cac75a99981078895d24bcab175987440bbff803b"
dependencies = [
"tz-rs",
]
[[package]]
name = "ucd-trie"
version = "0.1.7"
@ -3822,12 +3879,24 @@ dependencies = [
[[package]]
name = "windows"
version = "0.59.0"
version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f919aee0a93304be7f62e8e5027811bbba96bcb1de84d6618be56e43f8a32a1"
checksum = "ddf874e74c7a99773e62b1c671427abf01a425e77c3d3fb9fb1e4883ea934529"
dependencies = [
"windows-core 0.59.0",
"windows-targets 0.53.0",
"windows-collections",
"windows-core 0.60.1",
"windows-future",
"windows-link",
"windows-numerics",
]
[[package]]
name = "windows-collections"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5467f79cc1ba3f52ebb2ed41dbb459b8e7db636cc3429458d9a852e15bc24dec"
dependencies = [
"windows-core 0.60.1",
]
[[package]]
@ -3853,15 +3922,25 @@ dependencies = [
[[package]]
name = "windows-core"
version = "0.59.0"
version = "0.60.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "810ce18ed2112484b0d4e15d022e5f598113e220c53e373fb31e67e21670c1ce"
checksum = "ca21a92a9cae9bf4ccae5cf8368dce0837100ddf6e6d57936749e85f152f6247"
dependencies = [
"windows-implement 0.59.0",
"windows-interface 0.59.0",
"windows-result 0.3.0",
"windows-link",
"windows-result 0.3.1",
"windows-strings",
"windows-targets 0.53.0",
]
[[package]]
name = "windows-future"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a787db4595e7eb80239b74ce8babfb1363d8e343ab072f2ffe901400c03349f0"
dependencies = [
"windows-core 0.60.1",
"windows-link",
]
[[package]]
@ -3914,6 +3993,16 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3"
[[package]]
name = "windows-numerics"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "005dea54e2f6499f2cee279b8f703b3cf3b5734a2d8d21867c8f44003182eeed"
dependencies = [
"windows-core 0.60.1",
"windows-link",
]
[[package]]
name = "windows-result"
version = "0.1.2"
@ -3925,20 +4014,20 @@ dependencies = [
[[package]]
name = "windows-result"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d08106ce80268c4067c0571ca55a9b4e9516518eaa1a1fe9b37ca403ae1d1a34"
checksum = "06374efe858fab7e4f881500e6e86ec8bc28f9462c47e5a9941a0142ad86b189"
dependencies = [
"windows-targets 0.53.0",
"windows-link",
]
[[package]]
name = "windows-strings"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b888f919960b42ea4e11c2f408fadb55f78a9f236d5eef084103c8ce52893491"
checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"
dependencies = [
"windows-targets 0.53.0",
"windows-link",
]
[[package]]
@ -4265,7 +4354,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder",
"zerocopy-derive",
"zerocopy-derive 0.7.35",
]
[[package]]
name = "zerocopy"
version = "0.8.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09612fda0b63f7cb9e0af7e5916fe5a1f8cdcb066829f10f36883207628a4872"
dependencies = [
"zerocopy-derive 0.8.22",
]
[[package]]
@ -4279,6 +4377,17 @@ dependencies = [
"syn 2.0.98",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79f81d38d7a2ed52d8f034e62c568e111df9bf8aba2f7cf19ddc5bf7bd89d520"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
]
[[package]]
name = "zerofrom"
version = "0.1.5"

View File

@ -5,7 +5,7 @@ authors = ["Starship Contributors"]
build = "build.rs"
categories = ["command-line-utilities"]
documentation = "https://starship.rs/guide/"
edition = "2021"
edition = "2024"
homepage = "https://starship.rs"
# Keep `/` in front of `README.md` to exclude localized readmes
include = [
@ -23,7 +23,7 @@ license = "ISC"
readme = "README.md"
repository = "https://github.com/starship/starship"
# Note: MSRV is only intended as a hint, and only the latest version is officially supported in starship.
rust-version = "1.80"
rust-version = "1.85"
description = """
The minimal, blazing-fast, and infinitely customizable prompt for any shell! 🌌
"""
@ -66,7 +66,7 @@ pest = "2.7.15"
pest_derive = "2.7.15"
process_control = "5.0.0"
quick-xml = "0.37.2"
rand = "0.8.5"
rand = "0.9.0"
rayon = "1.10.0"
regex = { version = "1.11.1", default-features = false, features = ["perf", "std", "unicode-perl"] }
rust-ini = "0.21.1"
@ -74,7 +74,7 @@ semver = "1.0.26"
serde = { version = "1.0.218", features = ["derive"] }
serde_json = "1.0.140"
sha1 = "0.10.6"
shadow-rs = { version = "0.38.1", default-features = false }
shadow-rs = { version = "1.0.1", default-features = false, features = ["build"] }
# battery is optional (on by default) because the crate doesn't currently build for Termux
# see: https://github.com/svartalf/rust-battery/issues/33
starship-battery = { version = "0.10.0", optional = true }
@ -106,7 +106,7 @@ features = ["preserve_order", "indexmap2"]
deelevate = "0.2.0"
[target.'cfg(windows)'.dependencies.windows]
version = "0.59.0"
version = "0.60.0"
features = [
"Win32_Foundation",
"Win32_UI_Shell",
@ -119,7 +119,7 @@ features = [
nix = { version = "0.29.0", default-features = false, features = ["feature", "fs", "user"] }
[build-dependencies]
shadow-rs = { version = "0.38.1", default-features = false }
shadow-rs = { version = "1.0.1", default-features = false, features = ["build"] }
dunce = "1.0.5"
[target.'cfg(windows)'.build-dependencies]

View File

@ -3378,6 +3378,7 @@ Amazon = "🙂 "
Android = "🤖 "
Arch = "🎗️ "
Artix = "🎗️ "
Bluefin = "🐟 "
CachyOS = "🎗️ "
CentOS = "💠 "
Debian = "🌀 "

View File

@ -145,6 +145,7 @@ Amazon = "amz "
Android = "andr "
Arch = "rch "
Artix = "atx "
Bluefin = "blfn "
CachyOS = "cach "
CentOS = "cent "
Debian = "deb "

View File

@ -25,7 +25,10 @@ pub fn create() {
Style::new().bold().paint("Generated bug report:")
);
println!("Forward the pre-filled report above to GitHub in your browser?");
println!("{} To avoid any sensitive data from being exposed, please review the included information before proceeding. Data forwarded to GitHub is subject to GitHub's privacy policy.", Style::new().bold().paint("Warning:"));
println!(
"{} To avoid any sensitive data from being exposed, please review the included information before proceeding. Data forwarded to GitHub is subject to GitHub's privacy policy.",
Style::new().bold().paint("Warning:")
);
println!(
"Enter `{}` to accept, or anything else to decline, and `{}` to confirm your choice:\n",
Style::new().bold().paint("y"),
@ -39,10 +42,14 @@ pub fn create() {
let link = make_github_issue_link(&issue_body);
if let Err(e) = open::that(&link) {
println!("Failed to open issue report in your browser: {e}");
println!("Please copy the above report and open an issue manually, or try opening the following link:\n{link}");
println!(
"Please copy the above report and open an issue manually, or try opening the following link:\n{link}"
);
}
} else {
println!("Will not open an issue in your browser! Please copy the above report and open an issue manually.");
println!(
"Will not open an issue in your browser! Please copy the above report and open an issue manually."
);
}
println!("Thanks for using the Starship bug report tool!");
}

View File

@ -5,7 +5,7 @@ use crate::serde_utils::{ValueDeserializer, ValueRef};
use crate::utils;
use nu_ansi_term::Color;
use serde::{
de::value::Error as ValueError, de::Error as SerdeError, Deserialize, Deserializer, Serialize,
Deserialize, Deserializer, Serialize, de::Error as SerdeError, de::value::Error as ValueError,
};
use std::borrow::Cow;
@ -106,8 +106,8 @@ where
Either::<T, Vec<T>>::schema_name()
}
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
Either::<T, Vec<T>>::json_schema(gen)
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
Either::<T, Vec<T>>::json_schema(generator)
}
fn is_referenceable() -> bool {

View File

@ -1,4 +1,4 @@
use indexmap::{indexmap, IndexMap};
use indexmap::{IndexMap, indexmap};
use os_info::Type;
use serde::{Deserialize, Serialize};
@ -36,6 +36,7 @@ impl Default for OSConfig<'_> {
Type::Android => "🤖 ",
Type::Arch => "🎗️ ",
Type::Artix => "🎗️ ",
Type::Bluefin => "🐟 ",
Type::CachyOS => "🎗️ ",
Type::CentOS => "💠 ",
Type::Debian => "🌀 ",

View File

@ -47,8 +47,7 @@ impl Default for StatusConfig<'_> {
recognize_signal_code: true,
pipestatus: false,
pipestatus_separator: "|",
pipestatus_format:
"\\[$pipestatus\\] => [$symbol$common_meaning$signal_name$maybe_int]($style) ",
pipestatus_format: "\\[$pipestatus\\] => [$symbol$common_meaning$signal_name$maybe_int]($style) ",
pipestatus_segment_format: None,
disabled: true,
}

View File

@ -574,9 +574,11 @@ mod tests {
handle_update_configuration(&mut doc, "a.b.c.d.e.f.g.h", "true").unwrap();
assert!(doc["a"]["b"]["c"]["d"]["e"]["f"]["g"]["h"]
assert!(
doc["a"]["b"]["c"]["d"]["e"]["f"]["g"]["h"]
.as_bool()
.unwrap())
.unwrap()
)
}
#[test]

View File

@ -2,15 +2,16 @@ use crate::config::{ModuleConfig, StarshipConfig};
use crate::configs::StarshipRootConfig;
use crate::context_env::Env;
use crate::module::Module;
use crate::utils::{create_command, exec_timeout, read_file, CommandOutput, PathExt};
use crate::utils::{CommandOutput, PathExt, create_command, exec_timeout, read_file};
use crate::modules;
use crate::utils;
use clap::Parser;
use gix::{
Repository, ThreadSafeRepository,
repository::Kind,
sec::{self as git_sec, trust::DefaultForLevel},
state as git_state, Repository, ThreadSafeRepository,
state as git_state,
};
#[cfg(test)]
use std::collections::HashMap;
@ -979,39 +980,47 @@ mod tests {
let dc_following_symlinks = DirContents::from_path(d.path(), true)?;
assert!(ScanDir {
assert!(
ScanDir {
dir_contents: &dc_following_symlinks,
files: &["link_to_file"],
extensions: &[],
folders: &[],
}
.is_match());
.is_match()
);
assert!(ScanDir {
assert!(
ScanDir {
dir_contents: &dc_following_symlinks,
files: &[],
extensions: &[],
folders: &["link_to_folder"],
}
.is_match());
.is_match()
);
let dc_not_following_symlinks = DirContents::from_path(d.path(), false)?;
assert!(ScanDir {
assert!(
ScanDir {
dir_contents: &dc_not_following_symlinks,
files: &["link_to_file"],
extensions: &[],
folders: &[],
}
.is_match());
.is_match()
);
assert!(!ScanDir {
assert!(
!ScanDir {
dir_contents: &dc_not_following_symlinks,
files: &[],
extensions: &[],
folders: &["link_to_folder"],
}
.is_match());
.is_match()
);
Ok(())
}
@ -1022,91 +1031,107 @@ mod tests {
let follow_symlinks = true;
let empty_dc = DirContents::from_path(empty.path(), follow_symlinks)?;
assert!(!ScanDir {
assert!(
!ScanDir {
dir_contents: &empty_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match());
.is_match()
);
empty.close()?;
let rust = testdir(&["README.md", "Cargo.toml", "src/main.rs"])?;
let rust_dc = DirContents::from_path(rust.path(), follow_symlinks)?;
assert!(!ScanDir {
assert!(
!ScanDir {
dir_contents: &rust_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match());
.is_match()
);
rust.close()?;
let java = testdir(&["README.md", "src/com/test/Main.java", "pom.xml"])?;
let java_dc = DirContents::from_path(java.path(), follow_symlinks)?;
assert!(!ScanDir {
assert!(
!ScanDir {
dir_contents: &java_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match());
.is_match()
);
java.close()?;
let node = testdir(&["README.md", "node_modules/lodash/main.js", "package.json"])?;
let node_dc = DirContents::from_path(node.path(), follow_symlinks)?;
assert!(ScanDir {
assert!(
ScanDir {
dir_contents: &node_dc,
files: &["package.json"],
extensions: &["js"],
folders: &["node_modules"],
}
.is_match());
.is_match()
);
node.close()?;
let tarballs = testdir(&["foo.tgz", "foo.tar.gz"])?;
let tarballs_dc = DirContents::from_path(tarballs.path(), follow_symlinks)?;
assert!(ScanDir {
assert!(
ScanDir {
dir_contents: &tarballs_dc,
files: &[],
extensions: &["tar.gz"],
folders: &[],
}
.is_match());
.is_match()
);
tarballs.close()?;
let dont_match_ext = testdir(&["foo.js", "foo.ts"])?;
let dont_match_ext_dc = DirContents::from_path(dont_match_ext.path(), follow_symlinks)?;
assert!(!ScanDir {
assert!(
!ScanDir {
dir_contents: &dont_match_ext_dc,
files: &[],
extensions: &["js", "!notfound", "!ts"],
folders: &[],
}
.is_match());
.is_match()
);
dont_match_ext.close()?;
let dont_match_file = testdir(&["goodfile", "evilfile"])?;
let dont_match_file_dc = DirContents::from_path(dont_match_file.path(), follow_symlinks)?;
assert!(!ScanDir {
assert!(
!ScanDir {
dir_contents: &dont_match_file_dc,
files: &["goodfile", "!notfound", "!evilfile"],
extensions: &[],
folders: &[],
}
.is_match());
.is_match()
);
dont_match_file.close()?;
let dont_match_folder = testdir(&["gooddir/somefile", "evildir/somefile"])?;
let dont_match_folder_dc =
DirContents::from_path(dont_match_folder.path(), follow_symlinks)?;
assert!(!ScanDir {
assert!(
!ScanDir {
dir_contents: &dont_match_folder_dc,
files: &[],
extensions: &[],
folders: &["gooddir", "!notfound", "!evildir"],
}
.is_match());
.is_match()
);
dont_match_folder.close()?;
Ok(())

View File

@ -1,7 +1,7 @@
// Can't rename internal Pest names
#![allow(clippy::upper_case_acronyms)]
use pest::{error::Error, iterators::Pair, Parser};
use pest::{Parser, error::Error, iterators::Pair};
use pest_derive::*;
use super::model::*;

View File

@ -5,12 +5,12 @@ use std::collections::{BTreeMap, BTreeSet};
use std::error::Error;
use std::fmt;
use crate::config::{parse_style_string, Style};
use crate::config::{Style, parse_style_string};
use crate::context::{Context, Shell};
use crate::segment::Segment;
use super::model::*;
use super::parser::{parse, Rule};
use super::parser::{Rule, parse};
#[derive(Clone)]
enum VariableValue<'a> {

View File

@ -1,5 +1,5 @@
use super::string_formatter::StringFormatterError;
use super::StringFormatter;
use super::string_formatter::StringFormatterError;
use crate::segment;
use std::ops::Deref;
use std::sync::LazyLock;

View File

@ -8,7 +8,6 @@ use std::time::SystemTime;
use clap::{CommandFactory, Parser, Subcommand, ValueEnum};
use clap_complete::generate;
use rand::distributions::Alphanumeric;
use rand::Rng;
use starship::context::{Context, Properties, Target};
use starship::module::ALL_MODULES;
@ -269,8 +268,8 @@ fn main() {
Commands::Completions { shell } => generate_completions(shell),
Commands::Session => println!(
"{}",
rand::thread_rng()
.sample_iter(&Alphanumeric)
rand::rng()
.sample_iter(rand::distr::Alphanumeric)
.take(16)
.map(char::from)
.collect::<String>()

View File

@ -305,7 +305,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
mod tests {
use crate::test::ModuleRenderer;
use nu_ansi_term::Color;
use std::fs::{create_dir, File};
use std::fs::{File, create_dir};
use std::io::{self, Write};
#[test]
@ -497,13 +497,15 @@ mod tests {
let config_path = dir.path().join("credentials");
create_dir(&config_path)?;
assert!(ModuleRenderer::new("aws")
assert!(
ModuleRenderer::new("aws")
.env(
"AWS_SHARED_CREDENTIALS_FILE",
config_path.to_string_lossy().as_ref(),
)
.collect()
.is_none());
.is_none()
);
dir.close()
}
@ -514,10 +516,12 @@ mod tests {
let config_path = dir.path().join("config");
create_dir(&config_path)?;
assert!(ModuleRenderer::new("aws")
assert!(
ModuleRenderer::new("aws")
.env("AWS_CONFIG_FILE", config_path.to_string_lossy().as_ref())
.collect()
.is_none());
.is_none()
);
dir.close()
}

View File

@ -69,7 +69,7 @@ fn undistract_me<'a>(
elapsed: u128,
) -> Module<'a> {
use notify_rust::{Notification, Timeout};
use nu_ansi_term::{unstyle, AnsiStrings};
use nu_ansi_term::{AnsiStrings, unstyle};
if config.show_notifications && config.min_time_to_notify as u128 <= elapsed {
if cfg!(target_os = "linux") {

View File

@ -216,7 +216,9 @@ fn shell_command(cmd: &str, config: &CustomConfig, context: &Context) -> Option<
match output.wait().ok()? {
None => {
log::warn!("Executing custom command {cmd:?} timed out.");
log::warn!("You can set command_timeout in your config to a higher value or set ignore_timeout to true for this module to allow longer-running commands to keep executing.");
log::warn!(
"You can set command_timeout in your config to a higher value or set ignore_timeout to true for this module to allow longer-running commands to keep executing."
);
None
}
Some(status) => Some(status),
@ -312,7 +314,7 @@ mod tests {
use super::*;
use crate::context::Shell;
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
use crate::test::{FixtureProvider, ModuleRenderer, fixture_repo};
use nu_ansi_term::Color;
use std::fs::File;
use std::io;

View File

@ -1,5 +1,5 @@
use quick_xml::events::Event;
use quick_xml::Reader;
use quick_xml::events::Event;
use std::ffi::OsStr;
use std::iter::Iterator;
use std::path::{Path, PathBuf};
@ -308,7 +308,7 @@ fn get_latest_sdk_from_cli(context: &Context) -> Option<String> {
.lines()
.map(str::trim)
.filter(|l| !l.is_empty())
.last()
.next_back()
.or_else(parse_failed)?;
let take_until = latest_sdk.find('[').or_else(parse_failed)? - 1;
if take_until > 1 {
@ -355,7 +355,7 @@ mod tests {
use std::fs::{self, OpenOptions};
use std::io::{self, Write};
use tempfile::{self, TempDir};
use utils::{write_file, CommandOutput};
use utils::{CommandOutput, write_file};
#[test]
fn shows_nothing_in_directory_with_zero_relevant_files() -> io::Result<()> {

View File

@ -1,6 +1,6 @@
use super::{Context, Module};
use crate::config::{parse_style_string, ModuleConfig};
use crate::config::{ModuleConfig, parse_style_string};
use crate::configs::fill::FillConfig;
use crate::segment::Segment;

View File

@ -78,7 +78,7 @@ mod tests {
use nu_ansi_term::{Color, Style};
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
use crate::test::{FixtureProvider, ModuleRenderer, fixture_repo};
enum Expect<'a> {
BranchName(&'a str),

View File

@ -104,7 +104,7 @@ mod tests {
use nu_ansi_term::{Color, Style};
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
use crate::test::{FixtureProvider, ModuleRenderer, fixture_repo};
use super::FossilDiff;

View File

@ -151,7 +151,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
#[cfg(test)]
mod tests {
use std::fs::{create_dir, File};
use std::fs::{File, create_dir};
use std::io::{self, Write};
use nu_ansi_term::Color;

View File

@ -123,7 +123,7 @@ mod tests {
use nu_ansi_term::Color;
use std::io;
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
use crate::test::{FixtureProvider, ModuleRenderer, fixture_repo};
use crate::utils::create_command;
#[test]

View File

@ -81,7 +81,7 @@ mod tests {
use nu_ansi_term::Color;
use std::{io, str};
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
use crate::test::{FixtureProvider, ModuleRenderer, fixture_repo};
use crate::utils::create_command;
#[test]

View File

@ -1,8 +1,8 @@
use regex::Regex;
use crate::{
config::ModuleConfig, configs::git_metrics::GitMetricsConfig,
formatter::string_formatter::StringFormatterError, formatter::StringFormatter, module::Module,
config::ModuleConfig, configs::git_metrics::GitMetricsConfig, formatter::StringFormatter,
formatter::string_formatter::StringFormatterError, module::Module,
};
use super::Context;

View File

@ -521,7 +521,7 @@ mod tests {
use std::io::{self, prelude::*};
use std::path::Path;
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
use crate::test::{FixtureProvider, ModuleRenderer, fixture_repo};
use crate::utils::create_command;
#[allow(clippy::unnecessary_wraps)]

View File

@ -94,7 +94,7 @@ mod tests {
use std::io;
use std::path::Path;
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
use crate::test::{FixtureProvider, ModuleRenderer, fixture_repo};
use crate::utils::create_command;
enum Expect<'a> {

View File

@ -47,7 +47,9 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let mut module_symbol = "";
let mut module_number = String::new();
if config.threshold != default_threshold {
log::warn!("`threshold` in [jobs] is deprecated . Please remove it and use `symbol_threshold` and `number_threshold`.");
log::warn!(
"`threshold` in [jobs] is deprecated . Please remove it and use `symbol_threshold` and `number_threshold`."
);
// The symbol should be shown if there are *any* background
// jobs running.

View File

@ -349,12 +349,12 @@ mod deprecated {
#[cfg(test)]
mod tests {
use crate::modules::kubernetes::parse_kubeconfigs;
use crate::modules::kubernetes::Document;
use crate::modules::kubernetes::parse_kubeconfigs;
use crate::test::ModuleRenderer;
use nu_ansi_term::Color;
use std::env;
use std::fs::{create_dir, File};
use std::fs::{File, create_dir};
use std::io::{self, Write};
#[test]

View File

@ -103,9 +103,11 @@ mod tests {
#[test]
fn is_ipv4_format() {
let localip = get_localip!();
assert!(regex::Regex::new(r"^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$")
assert!(
regex::Regex::new(r"^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$")
.unwrap()
.is_match(&localip));
.is_match(&localip)
);
}
#[test]

View File

@ -1,6 +1,6 @@
use systemstat::{
data::{saturating_sub_bytes, ByteSize},
Platform, System,
data::{ByteSize, saturating_sub_bytes},
};
use super::{Context, Module, ModuleConfig};

View File

@ -215,7 +215,9 @@ pub fn handle<'a>(module: &str, context: &'a Context) -> Option<Module<'a>> {
custom::module(custom.strip_prefix("custom.").unwrap(), context)
}
_ => {
eprintln!("Error: Unknown module {module}. Use starship module --list to list out all supported modules.");
eprintln!(
"Error: Unknown module {module}. Use starship module --list to list out all supported modules."
);
None
}
}

View File

@ -110,7 +110,7 @@ fn parse_opam_switch(opam_switch: &str) -> Option<OpamSwitch> {
#[cfg(test)]
mod tests {
use super::{parse_opam_switch, SwitchType};
use super::{SwitchType, parse_opam_switch};
use crate::{test::ModuleRenderer, utils::CommandOutput};
use nu_ansi_term::Color;
use std::fs::{self, File};

View File

@ -32,7 +32,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
.map(|variable| match variable {
"version" => {
let odin_version = context.exec_cmd("odin", &["version"])?.stdout;
let trimmed_version = odin_version.split(' ').last()?.trim().to_string();
let trimmed_version = odin_version.split(' ').next_back()?.trim().to_string();
if config.show_commit {
return Some(Ok(trimmed_version));

View File

@ -318,7 +318,7 @@ mod tests {
#[test]
fn warn_on_os_info_update() {
#[warn(clippy::wildcard_enum_match_arm)]
#[deny(clippy::wildcard_enum_match_arm)]
// This closure is the same as the default config symbols list.
// When this clippy test fails, a new default symbol should be added to
// `config/os.rs` to exhaustively match new possible `os_info::Type` cases.
@ -337,6 +337,7 @@ mod tests {
Type::Amazon => "🙂 ",
Type::Android => "🤖 ",
Type::Arch | Type::Artix | Type::CachyOS => "🎗️ ",
Type::Bluefin => "🐟 ",
Type::CentOS | Type::AlmaLinux | Type::RockyLinux => "💠 ",
Type::Debian => "🌀 ",
Type::DragonFly => "🐉 ",

View File

@ -3,8 +3,8 @@ use crate::configs::package::PackageConfig;
use crate::formatter::{StringFormatter, VersionFormatter};
use ini::Ini;
use quick_xml::events::Event as QXEvent;
use quick_xml::Reader as QXReader;
use quick_xml::events::Event as QXEvent;
use regex::Regex;
use serde_json as json;
use std::fs;
@ -571,8 +571,8 @@ license = "MIT"
}
#[test]
fn test_extract_nimble_package_version_for_nimble_directory_when_nimble_is_not_available(
) -> io::Result<()> {
fn test_extract_nimble_package_version_for_nimble_directory_when_nimble_is_not_available()
-> io::Result<()> {
let config_name = "test_project.nimble";
let config_content = r#"

View File

@ -76,7 +76,7 @@ mod tests {
use std::io;
use std::path::Path;
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
use crate::test::{FixtureProvider, ModuleRenderer, fixture_repo};
enum Expect<'a> {
ChannelName(&'a str),

View File

@ -146,7 +146,7 @@ mod tests {
use super::*;
use crate::test::ModuleRenderer;
use nu_ansi_term::Color;
use std::fs::{create_dir_all, File};
use std::fs::{File, create_dir_all};
use std::io;
use std::io::Write;

View File

@ -3,7 +3,7 @@ use std::string::ToString;
use super::{Context, Module, ModuleConfig};
use crate::configs::status::StatusConfig;
use crate::formatter::{string_formatter::StringFormatterError, StringFormatter};
use crate::formatter::{StringFormatter, string_formatter::StringFormatterError};
use crate::segment::Segment;
type ExitCode = i32;

View File

@ -84,7 +84,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
fn is_login_user(context: &Context, username: &str) -> bool {
context
.get_env("LOGNAME")
.map_or(true, |logname| logname == username)
.is_none_or(|logname| logname == username)
}
#[cfg(all(target_os = "windows", not(test)))]

View File

@ -1,14 +1,13 @@
use std::{mem, os::windows::ffi::OsStrExt, path::Path};
use windows::{
core::PCWSTR,
Win32::{
Foundation::{CloseHandle, BOOL, ERROR_INSUFFICIENT_BUFFER, HANDLE},
Foundation::{CloseHandle, ERROR_INSUFFICIENT_BUFFER, HANDLE},
Security::{
AccessCheck, DuplicateToken, GetFileSecurityW, MapGenericMask, SecurityImpersonation,
DACL_SECURITY_INFORMATION, GENERIC_MAPPING, GROUP_SECURITY_INFORMATION,
OWNER_SECURITY_INFORMATION, PRIVILEGE_SET, PSECURITY_DESCRIPTOR, TOKEN_DUPLICATE,
TOKEN_IMPERSONATE, TOKEN_QUERY, TOKEN_READ_CONTROL,
AccessCheck, DACL_SECURITY_INFORMATION, DuplicateToken, GENERIC_MAPPING,
GROUP_SECURITY_INFORMATION, GetFileSecurityW, MapGenericMask,
OWNER_SECURITY_INFORMATION, PRIVILEGE_SET, PSECURITY_DESCRIPTOR, SecurityImpersonation,
TOKEN_DUPLICATE, TOKEN_IMPERSONATE, TOKEN_QUERY, TOKEN_READ_CONTROL,
},
Storage::FileSystem::{
FILE_ALL_ACCESS, FILE_GENERIC_EXECUTE, FILE_GENERIC_READ, FILE_GENERIC_WRITE,
@ -16,6 +15,7 @@ use windows::{
System::Threading::{GetCurrentProcess, OpenProcessToken},
UI::Shell::PathIsNetworkPathW,
},
core::{BOOL, PCWSTR},
};
struct Handle(HANDLE);
@ -60,7 +60,11 @@ pub fn is_write_allowed(folder_path: &Path) -> std::result::Result<bool, String>
// expect ERROR_INSUFFICIENT_BUFFER
match rc.ok() {
Err(e) if e.code() == ERROR_INSUFFICIENT_BUFFER.into() => (),
result => return Err(format!("GetFileSecurityW returned unexpected return value when asked for the security descriptor size: {result:?}")),
result => {
return Err(format!(
"GetFileSecurityW returned unexpected return value when asked for the security descriptor size: {result:?}"
));
}
}
let mut buf = vec![0u8; length as usize];

View File

@ -1,4 +1,4 @@
use clap::{builder::PossibleValue, ValueEnum};
use clap::{ValueEnum, builder::PossibleValue};
use nu_ansi_term::AnsiStrings;
use rayon::prelude::*;
use std::collections::BTreeSet;
@ -13,8 +13,8 @@ use unicode_width::UnicodeWidthChar;
use crate::configs::PROMPT_ORDER;
use crate::context::{Context, Properties, Shell, Target};
use crate::formatter::{StringFormatter, VariableHolder};
use crate::module::Module;
use crate::module::ALL_MODULES;
use crate::module::Module;
use crate::modules;
use crate::segment::Segment;
use crate::shadow;

View File

@ -45,11 +45,7 @@ impl FillSegment {
.cycle()
.scan(0usize, |len, g| {
*len += Grapheme(g).width();
if *len <= w {
Some(g)
} else {
None
}
if *len <= w { Some(g) } else { None }
})
.collect::<String>(),
None => String::from(&self.value),

View File

@ -1,7 +1,7 @@
use crate::module::ALL_MODULES;
use serde::de::{
value::{Error as ValueError, MapDeserializer, SeqDeserializer},
Deserializer, Error, IntoDeserializer, Visitor,
value::{Error as ValueError, MapDeserializer, SeqDeserializer},
};
use std::{cmp::Ordering, fmt};
use toml::Value;

View File

@ -2,7 +2,7 @@ use crate::context::{Context, Shell, Target};
use crate::logger::StarshipLogger;
use crate::{
config::StarshipConfig,
utils::{create_command, CommandOutput},
utils::{CommandOutput, create_command},
};
use log::{Level, LevelFilter};
use std::fs;

View File

@ -163,7 +163,7 @@ pub fn mock_cmd<T: AsRef<OsStr> + Debug, U: AsRef<OsStr> + Debug>(
) -> Option<Option<CommandOutput>> {
let command = display_command(&cmd, args);
let out = match command.as_str() {
"bun --version"=> Some(CommandOutput {
"bun --version" => Some(CommandOutput {
stdout: String::from("0.1.4\n"),
stderr: String::default(),
}),
@ -172,31 +172,38 @@ pub fn mock_cmd<T: AsRef<OsStr> + Debug, U: AsRef<OsStr> + Debug>(
stderr: String::default(),
}),
"cc --version" => Some(CommandOutput {
stdout: String::from("\
stdout: String::from(
"\
FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin"),
InstalledDir: /usr/bin",
),
stderr: String::default(),
}),
"gcc --version" => Some(CommandOutput {
stdout: String::from("\
stdout: String::from(
"\
cc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."),
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",
),
stderr: String::default(),
}),
"clang --version" => Some(CommandOutput {
stdout: String::from("\
stdout: String::from(
"\
OpenBSD clang version 11.1.0
Target: amd64-unknown-openbsd7.0
Thread model: posix
InstalledDir: /usr/bin"),
InstalledDir: /usr/bin",
),
stderr: String::default(),
}),
"cobc -version" => Some(CommandOutput {
stdout: String::from("\
stdout: String::from(
"\
cobc (GnuCOBOL) 3.1.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
@ -205,7 +212,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart
Built Dec 24 2020 19:08:58
Packaged Dec 23 2020 12:04:58 UTC
C version \"10.2.0\""),
C version \"10.2.0\"",
),
stderr: String::default(),
}),
"crystal --version" => Some(CommandOutput {
@ -226,7 +234,7 @@ Default target: x86_64-apple-macosx\n",
}),
"deno -V" => Some(CommandOutput {
stdout: String::from("deno 1.8.3\n"),
stderr: String::default()
stderr: String::default(),
}),
"dummy_command" => Some(CommandOutput {
stdout: String::from("stdout ok!\n"),
@ -249,21 +257,23 @@ Elixir 1.10 (compiled with Erlang/OTP 22)\n",
stdout: String::from("Fennel 1.2.1 on PUC Lua 5.4\n"),
stderr: String::default(),
}),
"fossil branch current" => Some(CommandOutput{
"fossil branch current" => Some(CommandOutput {
stdout: String::from("topic-branch"),
stderr: String::default(),
}),
"fossil branch new topic-branch trunk" => Some(CommandOutput{
"fossil branch new topic-branch trunk" => Some(CommandOutput {
stdout: String::default(),
stderr: String::default(),
}),
"fossil diff -i --numstat" => Some(CommandOutput{
stdout: String::from("\
"fossil diff -i --numstat" => Some(CommandOutput {
stdout: String::from(
"\
3 2 README.md
3 2 TOTAL over 1 changed files"),
3 2 TOTAL over 1 changed files",
),
stderr: String::default(),
}),
"fossil update topic-branch" => Some(CommandOutput{
"fossil update topic-branch" => Some(CommandOutput {
stdout: String::default(),
stderr: String::default(),
}),
@ -284,7 +294,9 @@ Elixir 1.10 (compiled with Erlang/OTP 22)\n",
stderr: String::default(),
}),
s if s.ends_with("java -Xinternalversion") => Some(CommandOutput {
stdout: String::from("OpenJDK 64-Bit Server VM (13.0.2+8) for bsd-amd64 JRE (13.0.2+8), built on Feb 6 2020 02:07:52 by \"brew\" with clang 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)"),
stdout: String::from(
"OpenJDK 64-Bit Server VM (13.0.2+8) for bsd-amd64 JRE (13.0.2+8), built on Feb 6 2020 02:07:52 by \"brew\" with clang 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)",
),
stderr: String::default(),
}),
"scala-cli version --scala" => Some(CommandOutput {
@ -292,7 +304,9 @@ Elixir 1.10 (compiled with Erlang/OTP 22)\n",
stderr: String::default(),
}),
"scalac -version" => Some(CommandOutput {
stdout: String::from("Scala compiler version 2.13.5 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc."),
stdout: String::from(
"Scala compiler version 2.13.5 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.",
),
stderr: String::default(),
}),
"julia --version" => Some(CommandOutput {
@ -307,19 +321,21 @@ Elixir 1.10 (compiled with Erlang/OTP 22)\n",
stdout: String::from("info: kotlinc-jvm 1.4.21 (JRE 14.0.1+7)\n"),
stderr: String::default(),
}),
"lua -v" => Some(CommandOutput{
"lua -v" => Some(CommandOutput {
stdout: String::from("Lua 5.4.0 Copyright (C) 1994-2020 Lua.org, PUC-Rio\n"),
stderr: String::default(),
}),
"luajit -v" => Some(CommandOutput{
stdout: String::from("LuaJIT 2.0.5 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/\n"),
"luajit -v" => Some(CommandOutput {
stdout: String::from(
"LuaJIT 2.0.5 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/\n",
),
stderr: String::default(),
}),
"mojo --version" => Some(CommandOutput {
stdout: String::from("mojo 24.4.0 (2cb57382)\n"),
stderr: String::default(),
}),
"nats context info --json" => Some(CommandOutput{
"nats context info --json" => Some(CommandOutput {
stdout: String::from("{\"name\":\"localhost\",\"url\":\"nats://localhost:4222\"}"),
stderr: String::default(),
}),
@ -347,14 +363,16 @@ active boot switches: -d:release\n",
stderr: String::default(),
}),
"opa version" => Some(CommandOutput {
stdout: String::from("Version: 0.44.0
stdout: String::from(
"Version: 0.44.0
Build Commit: e8d488f
Build Timestamp: 2022-09-07T23:50:25Z
Build Hostname: 119428673f4c
Go Version: go1.19.1
Platform: linux/amd64
WebAssembly: unavailable
"),
",
),
stderr: String::default(),
}),
"opam switch show --safe" => Some(CommandOutput {
@ -379,20 +397,20 @@ WebAssembly: unavailable
stdout: String::from("7.3.8"),
stderr: String::default(),
})
},
"pijul channel" => Some(CommandOutput{
}
"pijul channel" => Some(CommandOutput {
stdout: String::from(" main\n* tributary-48198"),
stderr: String::default(),
}),
"pijul channel new tributary-48198" => Some(CommandOutput{
"pijul channel new tributary-48198" => Some(CommandOutput {
stdout: String::default(),
stderr: String::default(),
}),
"pijul channel switch tributary-48198" => Some(CommandOutput{
"pijul channel switch tributary-48198" => Some(CommandOutput {
stdout: String::from("Outputting repository ↖"),
stderr: String::default(),
}),
"pulumi version" => Some(CommandOutput{
"pulumi version" => Some(CommandOutput {
stdout: String::from("1.2.3-ver.1631311768+e696fb6c"),
stderr: String::default(),
}),
@ -428,7 +446,7 @@ R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/."#
https://www.gnu.org/licenses/."#,
),
}),
"raku --version" => Some(CommandOutput {
@ -442,20 +460,23 @@ Built on MoarVM version 2021.12.\n",
}),
"red --version" => Some(CommandOutput {
stdout: String::from("0.6.4\n"),
stderr: String::default()
stderr: String::default(),
}),
"ruby -v" => Some(CommandOutput {
stdout: String::from("ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]\n"),
stderr: String::default(),
}),
"solc --version" => Some(CommandOutput {
stdout: String::from("solc, the solidity compiler commandline interface
Version: 0.8.16+commit.07a7930e.Linux.g++"),
stdout: String::from(
"solc, the solidity compiler commandline interface
Version: 0.8.16+commit.07a7930e.Linux.g++",
),
stderr: String::default(),
}),
"solcjs --version" => Some(CommandOutput {
stdout: String::from("0.8.15+commit.e14f2714.Emscripten.clang"),
stderr: String::default() }),
stderr: String::default(),
}),
"swift --version" => Some(CommandOutput {
stdout: String::from(
"\
@ -470,7 +491,7 @@ Target: x86_64-apple-darwin19.4.0\n",
}),
"v version" => Some(CommandOutput {
stdout: String::from("V 0.2 30c0659"),
stderr: String::default()
stderr: String::default(),
}),
"zig version" => Some(CommandOutput {
stdout: String::from("0.6.0\n"),
@ -610,7 +631,9 @@ pub fn exec_timeout(cmd: &mut Command, time_limit: Duration) -> Option<CommandOu
}
Ok(None) => {
log::warn!("Executing command {:?} timed out.", cmd.get_program());
log::warn!("You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing.");
log::warn!(
"You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing."
);
None
}
Err(error) => {