mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +00:00 
			
		
		
		
	Merge #5908
5908: fmt import
 r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
			
			
This commit is contained in:
		
						commit
						8146700f82
					
				@ -112,6 +112,22 @@ Avoid local `use MyEnum::*` imports.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Prefer `use crate::foo::bar` to `use super::bar`.
 | 
					Prefer `use crate::foo::bar` to `use super::bar`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When implementing `Debug` or `Display`, import `std::fmt`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```rust
 | 
				
			||||||
 | 
					// Good
 | 
				
			||||||
 | 
					use std::fmt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl fmt::Display for RenameError {
 | 
				
			||||||
 | 
					    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { .. }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Not as good
 | 
				
			||||||
 | 
					impl std::fmt::Display for RenameError {
 | 
				
			||||||
 | 
					    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { .. }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Order of Items
 | 
					# Order of Items
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Optimize for the reader who sees the file for the first time, and wants to get a general idea about what's going on.
 | 
					Optimize for the reader who sees the file for the first time, and wants to get a general idea about what's going on.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user