@@ -94,7 +94,7 @@ impl<'repo> Blame<'repo> {
94
94
}
95
95
96
96
impl < ' blame > BlameHunk < ' blame > {
97
- unsafe fn from_raw_const ( raw : * const raw:: git_blame_hunk ) -> BlameHunk < ' blame > {
97
+ unsafe fn from_raw_const ( raw : * const raw:: git_blame_hunk ) -> Self {
98
98
BlameHunk {
99
99
raw : raw as * mut raw:: git_blame_hunk ,
100
100
_marker : marker:: PhantomData ,
@@ -160,7 +160,7 @@ impl<'blame> BlameHunk<'blame> {
160
160
161
161
/// Returns number of lines in this hunk.
162
162
pub fn lines_in_hunk ( & self ) -> usize {
163
- unsafe { ( * self . raw ) . lines_in_hunk as usize }
163
+ unsafe { ( * self . raw ) . lines_in_hunk }
164
164
}
165
165
}
166
166
@@ -172,7 +172,7 @@ impl Default for BlameOptions {
172
172
173
173
impl BlameOptions {
174
174
/// Initialize options
175
- pub fn new ( ) -> BlameOptions {
175
+ pub fn new ( ) -> Self {
176
176
unsafe {
177
177
let mut raw: raw:: git_blame_options = mem:: zeroed ( ) ;
178
178
assert_eq ! (
@@ -184,7 +184,7 @@ impl BlameOptions {
184
184
}
185
185
}
186
186
187
- fn flag ( & mut self , opt : u32 , val : bool ) -> & mut BlameOptions {
187
+ fn flag ( & mut self , opt : u32 , val : bool ) -> & mut Self {
188
188
if val {
189
189
self . raw . flags |= opt;
190
190
} else {
@@ -194,69 +194,69 @@ impl BlameOptions {
194
194
}
195
195
196
196
/// Track lines that have moved within a file.
197
- pub fn track_copies_same_file ( & mut self , opt : bool ) -> & mut BlameOptions {
197
+ pub fn track_copies_same_file ( & mut self , opt : bool ) -> & mut Self {
198
198
self . flag ( raw:: GIT_BLAME_TRACK_COPIES_SAME_FILE , opt)
199
199
}
200
200
201
201
/// Track lines that have moved across files in the same commit.
202
- pub fn track_copies_same_commit_moves ( & mut self , opt : bool ) -> & mut BlameOptions {
202
+ pub fn track_copies_same_commit_moves ( & mut self , opt : bool ) -> & mut Self {
203
203
self . flag ( raw:: GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES , opt)
204
204
}
205
205
206
206
/// Track lines that have been copied from another file that exists
207
207
/// in the same commit.
208
- pub fn track_copies_same_commit_copies ( & mut self , opt : bool ) -> & mut BlameOptions {
208
+ pub fn track_copies_same_commit_copies ( & mut self , opt : bool ) -> & mut Self {
209
209
self . flag ( raw:: GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES , opt)
210
210
}
211
211
212
212
/// Track lines that have been copied from another file that exists
213
213
/// in any commit.
214
- pub fn track_copies_any_commit_copies ( & mut self , opt : bool ) -> & mut BlameOptions {
214
+ pub fn track_copies_any_commit_copies ( & mut self , opt : bool ) -> & mut Self {
215
215
self . flag ( raw:: GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES , opt)
216
216
}
217
217
218
218
/// Restrict the search of commits to those reachable following only
219
219
/// the first parents.
220
- pub fn first_parent ( & mut self , opt : bool ) -> & mut BlameOptions {
220
+ pub fn first_parent ( & mut self , opt : bool ) -> & mut Self {
221
221
self . flag ( raw:: GIT_BLAME_FIRST_PARENT , opt)
222
222
}
223
223
224
224
/// Use mailmap file to map author and committer names and email addresses
225
225
/// to canonical real names and email addresses. The mailmap will be read
226
226
/// from the working directory, or HEAD in a bare repository.
227
- pub fn use_mailmap ( & mut self , opt : bool ) -> & mut BlameOptions {
227
+ pub fn use_mailmap ( & mut self , opt : bool ) -> & mut Self {
228
228
self . flag ( raw:: GIT_BLAME_USE_MAILMAP , opt)
229
229
}
230
230
231
231
/// Ignore whitespace differences.
232
- pub fn ignore_whitespace ( & mut self , opt : bool ) -> & mut BlameOptions {
232
+ pub fn ignore_whitespace ( & mut self , opt : bool ) -> & mut Self {
233
233
self . flag ( raw:: GIT_BLAME_IGNORE_WHITESPACE , opt)
234
234
}
235
235
236
236
/// Setter for the id of the newest commit to consider.
237
- pub fn newest_commit ( & mut self , id : Oid ) -> & mut BlameOptions {
237
+ pub fn newest_commit ( & mut self , id : Oid ) -> & mut Self {
238
238
unsafe {
239
239
self . raw . newest_commit = * id. raw ( ) ;
240
240
}
241
241
self
242
242
}
243
243
244
244
/// Setter for the id of the oldest commit to consider.
245
- pub fn oldest_commit ( & mut self , id : Oid ) -> & mut BlameOptions {
245
+ pub fn oldest_commit ( & mut self , id : Oid ) -> & mut Self {
246
246
unsafe {
247
247
self . raw . oldest_commit = * id. raw ( ) ;
248
248
}
249
249
self
250
250
}
251
251
252
252
/// The first line in the file to blame.
253
- pub fn min_line ( & mut self , lineno : usize ) -> & mut BlameOptions {
253
+ pub fn min_line ( & mut self , lineno : usize ) -> & mut Self {
254
254
self . raw . min_line = lineno;
255
255
self
256
256
}
257
257
258
258
/// The last line in the file to blame.
259
- pub fn max_line ( & mut self , lineno : usize ) -> & mut BlameOptions {
259
+ pub fn max_line ( & mut self , lineno : usize ) -> & mut Self {
260
260
self . raw . max_line = lineno;
261
261
self
262
262
}
@@ -265,7 +265,7 @@ impl BlameOptions {
265
265
impl < ' repo > Binding for Blame < ' repo > {
266
266
type Raw = * mut raw:: git_blame ;
267
267
268
- unsafe fn from_raw ( raw : * mut raw:: git_blame ) -> Blame < ' repo > {
268
+ unsafe fn from_raw ( raw : * mut raw:: git_blame ) -> Self {
269
269
Blame {
270
270
raw,
271
271
_marker : marker:: PhantomData ,
@@ -286,7 +286,7 @@ impl<'repo> Drop for Blame<'repo> {
286
286
impl < ' blame > Binding for BlameHunk < ' blame > {
287
287
type Raw = * mut raw:: git_blame_hunk ;
288
288
289
- unsafe fn from_raw ( raw : * mut raw:: git_blame_hunk ) -> BlameHunk < ' blame > {
289
+ unsafe fn from_raw ( raw : * mut raw:: git_blame_hunk ) -> Self {
290
290
BlameHunk {
291
291
raw,
292
292
_marker : marker:: PhantomData ,
@@ -301,8 +301,8 @@ impl<'blame> Binding for BlameHunk<'blame> {
301
301
impl Binding for BlameOptions {
302
302
type Raw = * mut raw:: git_blame_options ;
303
303
304
- unsafe fn from_raw ( opts : * mut raw:: git_blame_options ) -> BlameOptions {
305
- BlameOptions { raw : * opts }
304
+ unsafe fn from_raw ( opts : * mut raw:: git_blame_options ) -> Self {
305
+ Self { raw : * opts }
306
306
}
307
307
308
308
fn raw ( & self ) -> * mut raw:: git_blame_options {
0 commit comments