@@ -275,7 +275,7 @@ impl File {
275
275
impl Drop for File {
276
276
fn drop ( & mut self ) {
277
277
// We need to flush the file on drop. Unfortunately, that is not possible to do in a
278
- // non-blocking fashion, but our only other option here is data that is residing in the
278
+ // non-blocking fashion, but our only other option here is losing data remaining in the
279
279
// write cache. Good task schedulers should be resilient to occasional blocking hiccups in
280
280
// file destructors so we don't expect this to be a common problem in practice.
281
281
let _ = task:: block_on ( self . flush ( ) ) ;
@@ -456,7 +456,7 @@ unsafe impl<T: Send> Send for Lock<T> {}
456
456
unsafe impl < T : Send > Sync for Lock < T > { }
457
457
458
458
#[ derive( Debug ) ]
459
- /// The state of the lock.
459
+ /// The state of a lock.
460
460
struct LockState < T > {
461
461
/// Set to `true` when locked.
462
462
locked : AtomicBool ,
@@ -495,7 +495,7 @@ impl<T> Lock<T> {
495
495
}
496
496
}
497
497
498
- // The lock was successfully aquired .
498
+ // The lock was successfully acquired .
499
499
Poll :: Ready ( LockGuard ( self . 0 . clone ( ) ) )
500
500
}
501
501
}
@@ -546,9 +546,9 @@ impl<T> DerefMut for LockGuard<T> {
546
546
}
547
547
}
548
548
549
- /// The current mode .
549
+ /// Modes a file can be in .
550
550
///
551
- /// The file can either be in idle mode, in reading mode, or writing mode.
551
+ /// The file can either be in idle mode, reading mode, or writing mode.
552
552
#[ derive( Debug ) ]
553
553
enum Mode {
554
554
/// The cache is empty.
@@ -688,8 +688,8 @@ impl LockGuard<State> {
688
688
689
689
/// Invalidates the read cache.
690
690
///
691
- /// This method will also move the file cursor backwards by the number of unconsumed bytes in
692
- /// the read cache.
691
+ /// This method will also move the internal file's cursor backwards by the number of unconsumed
692
+ /// bytes in the read cache.
693
693
fn poll_unread ( mut self , _: & mut Context < ' _ > ) -> Poll < io:: Result < Self > > {
694
694
match self . mode {
695
695
Mode :: Idle | Mode :: Writing => Poll :: Ready ( Ok ( self ) ) ,
@@ -790,12 +790,12 @@ impl LockGuard<State> {
790
790
791
791
/// Flushes the write cache into the file.
792
792
fn poll_flush ( mut self , cx : & mut Context < ' _ > ) -> Poll < io:: Result < Self > > {
793
- // If the file is already in flushed state, do nothing .
793
+ // If the file is already in flushed state, return .
794
794
if self . is_flushed {
795
795
return Poll :: Ready ( Ok ( self ) ) ;
796
796
}
797
797
798
- // If there is data in the write cache, drain in .
798
+ // If there is data in the write cache, drain it .
799
799
self = futures_core:: ready!( self . poll_drain( cx) ) ?;
800
800
801
801
// Register current task's interest in the file lock.
@@ -818,7 +818,7 @@ impl LockGuard<State> {
818
818
Poll :: Pending
819
819
}
820
820
821
- // This function does nothing because we're not sure about `AsyncWrite::poll_close()`'s
821
+ // This function does nothing because we're not sure about `AsyncWrite::poll_close()`'s exact
822
822
// semantics nor whether it will stay in the `AsyncWrite` trait.
823
823
fn poll_close ( self , _: & mut Context < ' _ > ) -> Poll < io:: Result < ( ) > > {
824
824
Poll :: Ready ( Ok ( ( ) ) )
0 commit comments