mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-01 04:17:37 +00:00
Shrink Dist from 352 to 288 bytes (#10389)
Found this when looking at #10385. Since we're constructing a lot of `Dist`s, we should keep it small.
This commit is contained in:
parent
15c81e9a02
commit
c5583b326f
4 changed files with 7 additions and 7 deletions
|
|
@ -21,7 +21,7 @@ async fn remote_metadata_with_and_without_cache() -> Result<()> {
|
|||
let filename = WheelFilename::from_str(url.rsplit_once('/').unwrap().1)?;
|
||||
let dist = BuiltDist::DirectUrl(DirectUrlBuiltDist {
|
||||
filename,
|
||||
location: Url::parse(url).unwrap(),
|
||||
location: Box::new(Url::parse(url).unwrap()),
|
||||
url: VerbatimUrl::from_str(url).unwrap(),
|
||||
});
|
||||
let capabilities = IndexCapabilities::default();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ pub(crate) async fn wheel_metadata(args: WheelMetadataArgs) -> Result<()> {
|
|||
.wheel_metadata(
|
||||
&BuiltDist::DirectUrl(DirectUrlBuiltDist {
|
||||
filename,
|
||||
location: archive.url,
|
||||
location: Box::new(archive.url),
|
||||
url: args.url,
|
||||
}),
|
||||
&capabilities,
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ pub struct DirectUrlBuiltDist {
|
|||
/// `https://example.org/packages/flask-3.0.0-py3-none-any.whl`
|
||||
pub filename: WheelFilename,
|
||||
/// The URL without the subdirectory fragment.
|
||||
pub location: Url,
|
||||
pub location: Box<Url>,
|
||||
/// The URL as it was provided by the user.
|
||||
pub url: VerbatimUrl,
|
||||
}
|
||||
|
|
@ -363,7 +363,7 @@ impl Dist {
|
|||
|
||||
Ok(Self::Built(BuiltDist::DirectUrl(DirectUrlBuiltDist {
|
||||
filename,
|
||||
location,
|
||||
location: Box::new(location),
|
||||
url,
|
||||
})))
|
||||
}
|
||||
|
|
@ -1343,8 +1343,8 @@ mod test {
|
|||
/// Ensure that we don't accidentally grow the `Dist` sizes.
|
||||
#[test]
|
||||
fn dist_size() {
|
||||
assert!(size_of::<Dist>() <= 352, "{}", size_of::<Dist>());
|
||||
assert!(size_of::<BuiltDist>() <= 352, "{}", size_of::<BuiltDist>());
|
||||
assert!(size_of::<Dist>() <= 288, "{}", size_of::<Dist>());
|
||||
assert!(size_of::<BuiltDist>() <= 288, "{}", size_of::<BuiltDist>());
|
||||
assert!(
|
||||
size_of::<SourceDist>() <= 264,
|
||||
"{}",
|
||||
|
|
|
|||
|
|
@ -1820,7 +1820,7 @@ impl Package {
|
|||
});
|
||||
let direct_dist = DirectUrlBuiltDist {
|
||||
filename,
|
||||
location: url.clone(),
|
||||
location: Box::new(url.clone()),
|
||||
url: VerbatimUrl::from_url(url),
|
||||
};
|
||||
let built_dist = BuiltDist::DirectUrl(direct_dist);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue