@@ -275,7 +275,7 @@ impl File {
275275impl Drop for File {
276276 fn drop ( & mut self ) {
277277 // 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
279279 // write cache. Good task schedulers should be resilient to occasional blocking hiccups in
280280 // file destructors so we don't expect this to be a common problem in practice.
281281 let _ = task:: block_on ( self . flush ( ) ) ;
@@ -456,7 +456,7 @@ unsafe impl<T: Send> Send for Lock<T> {}
456456unsafe impl < T : Send > Sync for Lock < T > { }
457457
458458#[ derive( Debug ) ]
459- /// The state of the lock.
459+ /// The state of a lock.
460460struct LockState < T > {
461461 /// Set to `true` when locked.
462462 locked : AtomicBool ,
@@ -495,7 +495,7 @@ impl<T> Lock<T> {
495495 }
496496 }
497497
498- // The lock was successfully aquired .
498+ // The lock was successfully acquired .
499499 Poll :: Ready ( LockGuard ( self . 0 . clone ( ) ) )
500500 }
501501}
@@ -546,9 +546,9 @@ impl<T> DerefMut for LockGuard<T> {
546546 }
547547}
548548
549- /// The current mode .
549+ /// Modes a file can be in .
550550///
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.
552552#[ derive( Debug ) ]
553553enum Mode {
554554 /// The cache is empty.
@@ -688,8 +688,8 @@ impl LockGuard<State> {
688688
689689 /// Invalidates the read cache.
690690 ///
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.
693693 fn poll_unread ( mut self , _: & mut Context < ' _ > ) -> Poll < io:: Result < Self > > {
694694 match self . mode {
695695 Mode :: Idle | Mode :: Writing => Poll :: Ready ( Ok ( self ) ) ,
@@ -790,12 +790,12 @@ impl LockGuard<State> {
790790
791791 /// Flushes the write cache into the file.
792792 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 .
794794 if self . is_flushed {
795795 return Poll :: Ready ( Ok ( self ) ) ;
796796 }
797797
798- // If there is data in the write cache, drain in .
798+ // If there is data in the write cache, drain it .
799799 self = futures_core:: ready!( self . poll_drain( cx) ) ?;
800800
801801 // Register current task's interest in the file lock.
@@ -818,7 +818,7 @@ impl LockGuard<State> {
818818 Poll :: Pending
819819 }
820820
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
822822 // semantics nor whether it will stay in the `AsyncWrite` trait.
823823 fn poll_close ( self , _: & mut Context < ' _ > ) -> Poll < io:: Result < ( ) > > {
824824 Poll :: Ready ( Ok ( ( ) ) )
0 commit comments