-
Notifications
You must be signed in to change notification settings - Fork 824
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
Rename WasiState::new()
to WasiState::builder()
#3471
Conversation
afcab5b
to
1194139
Compare
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.
Small additional change, then good to go.
lib/wasi/src/state/mod.rs
Outdated
@@ -264,7 +264,14 @@ impl WasiState { | |||
/// Create a [`WasiStateBuilder`] to construct a validated instance of | |||
/// [`WasiState`]. | |||
#[allow(clippy::new_ret_no_self)] | |||
#[deprecated = "Use WasiState::builder()"] |
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.
#[deprecated = "Use WasiState::builder()"] | |
#[deprecated(note = "Use WasiState::builder() instead", since = "3.2.0"] |
lib/wasi/src/state/mod.rs
Outdated
|
||
/// Create a [`WasiStateBuilder`] to construct a validated instance of | ||
/// [`WasiState`]. | ||
pub fn builder(program_name: impl AsRef<str>) -> WasiStateBuilder { | ||
create_wasi_state(program_name.as_ref()) |
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.
While you are it it, can you do: create_wasi_state()
-> WasiStateBuilder::new()
?
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.
LGTM
Do we have a solution for the nasty CI issues?
@theduke it looks like the CI issues are coming from the |
The typical convention is for
Foo::new()
to return an instance ofFoo
andFoo::builder()
to return some type of builder object. OurWasiState
type doesn't follow this convention (and explicitly#[allow]
s the associated clippy warning), so the API can be confusing for anyone that hasn't used it before.I've renamed the
WasiState::new()
function toWasiState::builder()
and added a#[deprecated]
attribute to the originalWasiState::new()
so it doesn't break Deploy.