Fix compilation error and deprecations

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2024-07-12 23:47:22 +10:00
parent 03c520e7ce
commit 2bd9c1efee
No known key found for this signature in database
GPG key ID: 76D1E687CA3C4928
3 changed files with 18 additions and 18 deletions

View file

@ -338,10 +338,10 @@ mod test {
pub(super) const RELEASE: GhRelease = GhRelease {
repo: GhRepo {
owner: CompactString::new_inline("cargo-bins"),
repo: CompactString::new_inline("cargo-binstall"),
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("cargo-binstall"),
},
tag: CompactString::new_inline("v0.20.1"),
tag: CompactString::const_new("v0.20.1"),
};
pub(super) const ARTIFACTS: &[&str] = &[
@ -375,10 +375,10 @@ mod test {
pub(super) const RELEASE: GhRelease = GhRelease {
repo: GhRepo {
owner: CompactString::new_inline("rustsec"),
repo: CompactString::new_inline("rustsec"),
owner: CompactString::const_new("rustsec"),
repo: CompactString::const_new("rustsec"),
},
tag: CompactString::new_inline("cargo-audit/v0.17.6"),
tag: CompactString::const_new("cargo-audit/v0.17.6"),
};
#[allow(unused)]
@ -417,7 +417,7 @@ mod test {
]
.into_iter()
.for_each(|url| {
let url = Url::parse(&url).unwrap();
let url = Url::parse(url).unwrap();
assert_eq!(
GhRepo::try_extract_from_url(&url)
.unwrap()
@ -545,16 +545,16 @@ mod test {
#[tokio::test]
async fn rate_limited_test_get_repo_info() {
const PUBLIC_REPOS: [GhRepo; 1] = [GhRepo {
owner: CompactString::new_inline("cargo-bins"),
repo: CompactString::new_inline("cargo-binstall"),
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("cargo-binstall"),
}];
const PRIVATE_REPOS: [GhRepo; 1] = [GhRepo {
owner: CompactString::new_inline("cargo-bins"),
repo: CompactString::new_inline("private-repo-for-testing"),
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("private-repo-for-testing"),
}];
const NON_EXISTENT_REPOS: [GhRepo; 1] = [GhRepo {
owner: CompactString::new_inline("cargo-bins"),
repo: CompactString::new_inline("ttt"),
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("ttt"),
}];
init_logger();
@ -610,12 +610,12 @@ mod test {
)];
const NON_EXISTENT_RELEASES: [GhRelease; 1] = [GhRelease {
repo: GhRepo {
owner: CompactString::new_inline("cargo-bins"),
repo: CompactString::new_inline("cargo-binstall"),
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("cargo-binstall"),
},
// We are currently at v0.20.1 and we would never release
// anything older than v0.20.1
tag: CompactString::new_inline("v0.18.2"),
tag: CompactString::const_new("v0.18.2"),
}];
init_logger();

View file

@ -210,7 +210,7 @@ root = "/some/path" # `cargo install` destination directory
);
let http = config.http.unwrap();
assert_eq!(http.proxy.unwrap(), CompactString::new_inline("host:port"));
assert_eq!(http.proxy.unwrap(), CompactString::const_new("host:port"));
assert_eq!(http.timeout.unwrap(), 30);
assert_eq!(http.cainfo.unwrap(), Path::new("root").join("cert.pem"));

View file

@ -127,7 +127,7 @@ pub(super) fn render_dl_template(
struct Context<'a> {
crate_name: &'a str,
crate_prefix: CompactString,
crate_lowerprefix: String,
crate_lowerprefix: CompactString,
version: &'a str,
cksum: &'a str,
}