Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve examples for file locking #136704

Merged
merged 1 commit into from
Feb 11, 2025
Merged

Improve examples for file locking #136704

merged 1 commit into from
Feb 11, 2025

Conversation

benschulz
Copy link
Contributor

The lock and try_lock documentation states that "if the file not open for writing, it is unspecified whether this function returns an error." With this change, the examples use File::create instead of File::open, eliminating the possibility of someone blindly copying code with unspecified behavior.

@rustbot
Copy link
Collaborator

rustbot commented Feb 7, 2025

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 7, 2025
@ibraheemdev
Copy link
Member

Thanks. @bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 11, 2025

📌 Commit 8ea20c8 has been approved by ibraheemdev

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 11, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 11, 2025
Improve examples for file locking

The `lock` and `try_lock` documentation states that "if the file not open for writing, it is unspecified whether this function returns an error." With this change, the examples use `File::create` instead of `File::open`, eliminating the possibility of someone blindly copying code with unspecified behavior.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 11, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang#136606 (Fix long lines which rustfmt fails to format)
 - rust-lang#136663 (Stabilize `NonZero::count_ones`)
 - rust-lang#136672 (library: doc: core::alloc::Allocator: trivial typo fix)
 - rust-lang#136704 (Improve examples for file locking)
 - rust-lang#136721 (cg_llvm: Reduce visibility of some items outside the `llvm` module)
 - rust-lang#136813 (rustc_target: Add the fp16 target feature for AArch32)
 - rust-lang#136830 (fix i686-unknown-hurd-gnu x87 footnote)
 - rust-lang#136832 (Fix platform support table for i686-unknown-uefi)
 - rust-lang#136835 (Stop using span hack for contracts feature gating)
 - rust-lang#136837 (Overhaul how contracts are lowered on fn-like bodies)
 - rust-lang#136839 (fix ensure_monomorphic_enough)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2996cfd into rust-lang:master Feb 11, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 11, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 11, 2025
Rollup merge of rust-lang#136704 - benschulz:patch-1, r=ibraheemdev

Improve examples for file locking

The `lock` and `try_lock` documentation states that "if the file not open for writing, it is unspecified whether this function returns an error." With this change, the examples use `File::create` instead of `File::open`, eliminating the possibility of someone blindly copying code with unspecified behavior.
@benschulz benschulz deleted the patch-1 branch February 11, 2025 14:28
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants