@@ -581,10 +581,7 @@ impl GlobalState {
581581 // When we're running multiple flychecks, we have to include a disambiguator in
582582 // the title, or the editor complains. Note that this is a user-facing string.
583583 let title = if self . flycheck . len ( ) == 1 {
584- match self . config . flycheck ( ) {
585- Some ( config) => format ! ( "{}" , config) ,
586- None => "cargo check" . to_string ( ) ,
587- }
584+ format ! ( "{}" , self . config. flycheck( ) )
588585 } else {
589586 format ! ( "cargo check (#{})" , id + 1 )
590587 } ;
@@ -593,7 +590,7 @@ impl GlobalState {
593590 state,
594591 message,
595592 None ,
596- Some ( format ! ( "rust-analyzer/checkOnSave /{}" , id) ) ,
593+ Some ( format ! ( "rust-analyzer/flycheck /{}" , id) ) ,
597594 ) ;
598595 }
599596 }
@@ -796,7 +793,7 @@ impl GlobalState {
796793 } ) ?
797794 . on :: < lsp_types:: notification:: WorkDoneProgressCancel > ( |this, params| {
798795 if let lsp_types:: NumberOrString :: String ( s) = & params. token {
799- if let Some ( id) = s. strip_prefix ( "rust-analyzer/checkOnSave /" ) {
796+ if let Some ( id) = s. strip_prefix ( "rust-analyzer/flycheck /" ) {
800797 if let Ok ( id) = u32:: from_str_radix ( id, 10 ) {
801798 if let Some ( flycheck) = this. flycheck . get ( id as usize ) {
802799 flycheck. cancel ( ) ;
@@ -888,14 +885,14 @@ impl GlobalState {
888885 }
889886 }
890887
891- if run_flycheck ( this, vfs_path) {
888+ if !this . config . check_on_save ( ) || run_flycheck ( this, vfs_path) {
892889 return Ok ( ( ) ) ;
893890 }
894- }
895-
896- // No specific flycheck was triggered, so let's trigger all of them.
897- for flycheck in this . flycheck . iter ( ) {
898- flycheck . restart ( ) ;
891+ } else if this . config . check_on_save ( ) {
892+ // No specific flycheck was triggered, so let's trigger all of them.
893+ for flycheck in this . flycheck . iter ( ) {
894+ flycheck. restart ( ) ;
895+ }
899896 }
900897 Ok ( ( ) )
901898 } ) ?
0 commit comments