-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify feature-handling code #3742
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,16 +319,6 @@ fn calculate<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) | |
return Ok(s.clone()) | ||
} | ||
|
||
// First, calculate all statically known "salt data" such as the profile | ||
// information (compiler flags), the compiler version, activated features, | ||
// and target configuration. | ||
let features = cx.resolve.features(unit.pkg.package_id()); | ||
let features = features.map(|s| { | ||
let mut v = s.iter().collect::<Vec<_>>(); | ||
v.sort(); | ||
v | ||
}); | ||
|
||
// Next, recursively calculate the fingerprint for all of our dependencies. | ||
// | ||
// Skip the fingerprints of build scripts as they may not always be | ||
|
@@ -365,7 +355,7 @@ fn calculate<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) | |
rustc: util::hash_u64(&cx.config.rustc()?.verbose_version), | ||
target: util::hash_u64(&unit.target), | ||
profile: util::hash_u64(&unit.profile), | ||
features: format!("{:?}", features), | ||
features: format!("{:?}", cx.resolve.features_sorted(unit.pkg.package_id())), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the only place where behavior is changed, because we don't print There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah yeah this is totally fine |
||
deps: deps, | ||
local: local, | ||
memoized_hash: Mutex::new(None), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also possible to make this a function-local lazy-static I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah I prefer this, thanks!