2013-05-03 23:25:04 +00:00
|
|
|
[attr]rust text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4
|
|
|
|
|
2013-09-19 23:06:05 +00:00
|
|
|
* text=auto eol=lf
|
2013-05-03 23:25:04 +00:00
|
|
|
*.cpp rust
|
|
|
|
*.h rust
|
Nicer hunk headers for rust files
I found this trick at
<https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more>
Before the hunk headers for changes in methods would refer to the impl:
```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -678,7 +678,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckResults<'tcx> {
ref closure_captures,
ref generator_interior_types,
} = *self;
-
+ // foo
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
type_dependent_defs.hash_stable(hcx, hasher);
field_indices.hash_stable(hcx, hasher);
```
After the hunk headers refer to the actual function signature:
```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -678,7 +678,7 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
ref closure_captures,
ref generator_interior_types,
} = *self;
-
+ // foo
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
type_dependent_defs.hash_stable(hcx, hasher);
field_indices.hash_stable(hcx, hasher);
```
When the function signature is visible, it will use the function
signature of the previous method as hunk header:
```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..63058dfc837 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -992,6 +992,7 @@ pub fn typeck_opt_const_arg(
}
pub fn alloc_steal_mir(self, mir: Body<'tcx>) -> &'tcx Steal<Body<'tcx>> {
+ // foo
self.arena.alloc(Steal::new(mir))
}
```
2020-11-08 15:40:00 +00:00
|
|
|
*.rs rust diff=rust
|
2018-05-28 09:36:13 +00:00
|
|
|
*.fixed linguist-language=Rust
|
2020-11-17 22:16:18 +00:00
|
|
|
*.mir linguist-language=Rust
|
2017-01-21 01:03:06 +00:00
|
|
|
src/etc/installer/gfx/* binary
|
2017-02-10 16:27:34 +00:00
|
|
|
src/vendor/** -text
|
2019-08-20 13:56:46 +00:00
|
|
|
Cargo.lock linguist-generated=false
|
2021-03-24 00:20:12 +00:00
|
|
|
config.toml.example linguist-language=TOML
|
2019-01-23 10:54:23 +00:00
|
|
|
|
2021-03-16 16:14:01 +00:00
|
|
|
# Older git versions try to fix line endings on images and fonts, this prevents it.
|
2019-01-23 10:54:23 +00:00
|
|
|
*.png binary
|
|
|
|
*.ico binary
|
2021-03-16 16:14:01 +00:00
|
|
|
*.woff binary
|
|
|
|
*.woff2 binary
|
2021-05-15 02:52:28 +00:00
|
|
|
|
|
|
|
# Needed as part of converting rustfmt to a subtree, can hopefully be removed later.
|
|
|
|
src/tools/rustfmt/tests/source/issue-3494/crlf.rs -text
|
|
|
|
src/tools/rustfmt/tests/source/comment_crlf_newline.rs -text
|
|
|
|
src/tools/rustfmt/tests/source/configs/enum_discrim_align_threshold/40.rs -text
|
|
|
|
src/tools/rustfmt/tests/target/issue-3494/crlf.rs -text
|
|
|
|
src/tools/rustfmt/tests/target/comment_crlf_newline.rs -text
|
|
|
|
src/tools/rustfmt/tests/target/configs/enum_discrim_align_threshold/40.rs -text
|