mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-04 19:03:38 +00:00
chore: apply clippy for rust 1.76 & bump msrv (#5763)
This commit is contained in:
parent
7485c90c9f
commit
7290c5e368
@ -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.65"
|
||||
rust-version = "1.71"
|
||||
description = """
|
||||
The minimal, blazing-fast, and infinitely customizable prompt for any shell! ☄🌌️
|
||||
"""
|
||||
|
@ -339,10 +339,8 @@ impl<'a> Context<'a> {
|
||||
);
|
||||
|
||||
let branch = get_current_branch(&repository);
|
||||
let remote = get_remote_repository_info(
|
||||
&repository,
|
||||
branch.as_ref().map(|name| name.as_ref()),
|
||||
);
|
||||
let remote =
|
||||
get_remote_repository_info(&repository, branch.as_ref().map(AsRef::as_ref));
|
||||
let path = repository.path().to_path_buf();
|
||||
|
||||
let fs_monitor_value_is_true = repository
|
||||
|
@ -85,7 +85,7 @@ impl FromStr for DirenvState {
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match serde_json::from_str::<RawDirenvState>(s) {
|
||||
Ok(raw) => Ok(DirenvState {
|
||||
Ok(raw) => Ok(Self {
|
||||
rc_path: raw.state.found_rc.path,
|
||||
allowed: raw.state.found_rc.allowed.try_into()?,
|
||||
loaded: matches!(
|
||||
@ -93,7 +93,7 @@ impl FromStr for DirenvState {
|
||||
AllowStatus::Allowed
|
||||
),
|
||||
}),
|
||||
Err(_) => DirenvState::from_lines(s),
|
||||
Err(_) => Self::from_lines(s),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -225,7 +225,7 @@ mod tests {
|
||||
let dir = tempfile::tempdir()?;
|
||||
let rc_path = dir.path().join(".envrc");
|
||||
|
||||
std::fs::File::create(&rc_path)?.sync_all()?;
|
||||
std::fs::File::create(rc_path)?.sync_all()?;
|
||||
|
||||
let renderer = ModuleRenderer::new("direnv")
|
||||
.config(toml::toml! {
|
||||
@ -242,7 +242,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
Some(format!("direnv not loaded/allowed ")),
|
||||
Some("direnv not loaded/allowed ".to_string()),
|
||||
renderer.collect()
|
||||
);
|
||||
|
||||
@ -281,7 +281,7 @@ mod tests {
|
||||
let dir = tempfile::tempdir()?;
|
||||
let rc_path = dir.path().join(".envrc");
|
||||
|
||||
std::fs::File::create(&rc_path)?.sync_all()?;
|
||||
std::fs::File::create(rc_path)?.sync_all()?;
|
||||
|
||||
let renderer = ModuleRenderer::new("direnv")
|
||||
.config(toml::toml! {
|
||||
@ -297,7 +297,10 @@ mod tests {
|
||||
}),
|
||||
);
|
||||
|
||||
assert_eq!(Some(format!("direnv loaded/allowed ")), renderer.collect());
|
||||
assert_eq!(
|
||||
Some("direnv loaded/allowed ".to_string()),
|
||||
renderer.collect()
|
||||
);
|
||||
|
||||
dir.close()
|
||||
}
|
||||
@ -334,7 +337,7 @@ mod tests {
|
||||
let dir = tempfile::tempdir()?;
|
||||
let rc_path = dir.path().join(".envrc");
|
||||
|
||||
std::fs::File::create(&rc_path)?.sync_all()?;
|
||||
std::fs::File::create(rc_path)?.sync_all()?;
|
||||
|
||||
let renderer = ModuleRenderer::new("direnv")
|
||||
.config(toml::toml! {
|
||||
@ -350,7 +353,10 @@ mod tests {
|
||||
}),
|
||||
);
|
||||
|
||||
assert_eq!(Some(format!("direnv loaded/denied ")), renderer.collect());
|
||||
assert_eq!(
|
||||
Some("direnv loaded/denied ".to_string()),
|
||||
renderer.collect()
|
||||
);
|
||||
|
||||
dir.close()
|
||||
}
|
||||
@ -359,7 +365,7 @@ mod tests {
|
||||
let dir = tempfile::tempdir()?;
|
||||
let rc_path = dir.path().join(".envrc");
|
||||
|
||||
std::fs::File::create(&rc_path)?.sync_all()?;
|
||||
std::fs::File::create(rc_path)?.sync_all()?;
|
||||
|
||||
let renderer = ModuleRenderer::new("direnv")
|
||||
.config(toml::toml! {
|
||||
@ -376,7 +382,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
Some(format!("direnv loaded/not allowed ")),
|
||||
Some("direnv loaded/not allowed ".to_string()),
|
||||
renderer.collect()
|
||||
);
|
||||
|
||||
|
@ -270,7 +270,7 @@ fn get_local_dotnet_files(context: &Context) -> Result<Vec<DotNetFile>, std::io:
|
||||
fn get_dotnet_file_type(path: &Path) -> Option<FileType> {
|
||||
let file_name_lower = map_str_to_lower(path.file_name());
|
||||
|
||||
match file_name_lower.as_ref().map(std::convert::AsRef::as_ref) {
|
||||
match file_name_lower.as_ref().map(AsRef::as_ref) {
|
||||
Some(GLOBAL_JSON_FILE) => return Some(FileType::GlobalJson),
|
||||
Some(PROJECT_JSON_FILE) => return Some(FileType::ProjectJson),
|
||||
_ => (),
|
||||
@ -278,7 +278,7 @@ fn get_dotnet_file_type(path: &Path) -> Option<FileType> {
|
||||
|
||||
let extension_lower = map_str_to_lower(path.extension());
|
||||
|
||||
match extension_lower.as_ref().map(std::convert::AsRef::as_ref) {
|
||||
match extension_lower.as_ref().map(AsRef::as_ref) {
|
||||
Some("sln") => return Some(FileType::SolutionFile),
|
||||
Some("csproj" | "fsproj" | "xproj") => return Some(FileType::ProjectFile),
|
||||
Some("props" | "targets") => return Some(FileType::MsBuildFile),
|
||||
|
@ -136,7 +136,7 @@ pub fn display_command<T: AsRef<OsStr> + Debug, U: AsRef<OsStr> + Debug>(
|
||||
args: &[U],
|
||||
) -> String {
|
||||
std::iter::once(cmd.as_ref())
|
||||
.chain(args.iter().map(std::convert::AsRef::as_ref))
|
||||
.chain(args.iter().map(AsRef::as_ref))
|
||||
.map(|i| i.to_string_lossy().into_owned())
|
||||
.collect::<Vec<String>>()
|
||||
.join(" ")
|
||||
|
Loading…
Reference in New Issue
Block a user