Skip to content

Commit 5f9b821

Browse files
committed
ran cargo clippy --fix -- -A clippy::all -W clippy::use_self
1 parent 53442d4 commit 5f9b821

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+587
-587
lines changed

src/blame.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'repo> Blame<'repo> {
9494
}
9595

9696
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 {
9898
BlameHunk {
9999
raw: raw as *mut raw::git_blame_hunk,
100100
_marker: marker::PhantomData,
@@ -172,7 +172,7 @@ impl Default for BlameOptions {
172172

173173
impl BlameOptions {
174174
/// Initialize options
175-
pub fn new() -> BlameOptions {
175+
pub fn new() -> Self {
176176
unsafe {
177177
let mut raw: raw::git_blame_options = mem::zeroed();
178178
assert_eq!(
@@ -184,7 +184,7 @@ impl BlameOptions {
184184
}
185185
}
186186

187-
fn flag(&mut self, opt: u32, val: bool) -> &mut BlameOptions {
187+
fn flag(&mut self, opt: u32, val: bool) -> &mut Self {
188188
if val {
189189
self.raw.flags |= opt;
190190
} else {
@@ -194,69 +194,69 @@ impl BlameOptions {
194194
}
195195

196196
/// 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 {
198198
self.flag(raw::GIT_BLAME_TRACK_COPIES_SAME_FILE, opt)
199199
}
200200

201201
/// 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 {
203203
self.flag(raw::GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES, opt)
204204
}
205205

206206
/// Track lines that have been copied from another file that exists
207207
/// 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 {
209209
self.flag(raw::GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES, opt)
210210
}
211211

212212
/// Track lines that have been copied from another file that exists
213213
/// 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 {
215215
self.flag(raw::GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES, opt)
216216
}
217217

218218
/// Restrict the search of commits to those reachable following only
219219
/// 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 {
221221
self.flag(raw::GIT_BLAME_FIRST_PARENT, opt)
222222
}
223223

224224
/// Use mailmap file to map author and committer names and email addresses
225225
/// to canonical real names and email addresses. The mailmap will be read
226226
/// 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 {
228228
self.flag(raw::GIT_BLAME_USE_MAILMAP, opt)
229229
}
230230

231231
/// 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 {
233233
self.flag(raw::GIT_BLAME_IGNORE_WHITESPACE, opt)
234234
}
235235

236236
/// 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 {
238238
unsafe {
239239
self.raw.newest_commit = *id.raw();
240240
}
241241
self
242242
}
243243

244244
/// 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 {
246246
unsafe {
247247
self.raw.oldest_commit = *id.raw();
248248
}
249249
self
250250
}
251251

252252
/// 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 {
254254
self.raw.min_line = lineno;
255255
self
256256
}
257257

258258
/// 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 {
260260
self.raw.max_line = lineno;
261261
self
262262
}
@@ -265,7 +265,7 @@ impl BlameOptions {
265265
impl<'repo> Binding for Blame<'repo> {
266266
type Raw = *mut raw::git_blame;
267267

268-
unsafe fn from_raw(raw: *mut raw::git_blame) -> Blame<'repo> {
268+
unsafe fn from_raw(raw: *mut raw::git_blame) -> Self {
269269
Blame {
270270
raw,
271271
_marker: marker::PhantomData,
@@ -286,7 +286,7 @@ impl<'repo> Drop for Blame<'repo> {
286286
impl<'blame> Binding for BlameHunk<'blame> {
287287
type Raw = *mut raw::git_blame_hunk;
288288

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 {
290290
BlameHunk {
291291
raw,
292292
_marker: marker::PhantomData,
@@ -301,8 +301,8 @@ impl<'blame> Binding for BlameHunk<'blame> {
301301
impl Binding for BlameOptions {
302302
type Raw = *mut raw::git_blame_options;
303303

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 }
306306
}
307307

308308
fn raw(&self) -> *mut raw::git_blame_options {

src/blob.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'repo> Blob<'repo> {
5454
impl<'repo> Binding for Blob<'repo> {
5555
type Raw = *mut raw::git_blob;
5656

57-
unsafe fn from_raw(raw: *mut raw::git_blob) -> Blob<'repo> {
57+
unsafe fn from_raw(raw: *mut raw::git_blob) -> Self {
5858
Blob {
5959
raw,
6060
_marker: marker::PhantomData,
@@ -108,7 +108,7 @@ impl<'repo> BlobWriter<'repo> {
108108
impl<'repo> Binding for BlobWriter<'repo> {
109109
type Raw = *mut raw::git_writestream;
110110

111-
unsafe fn from_raw(raw: *mut raw::git_writestream) -> BlobWriter<'repo> {
111+
unsafe fn from_raw(raw: *mut raw::git_writestream) -> Self {
112112
BlobWriter {
113113
raw,
114114
need_cleanup: true,

src/branch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'repo> Branch<'repo> {
6868
}
6969

7070
/// Move/rename an existing local branch reference.
71-
pub fn rename(&mut self, new_branch_name: &str, force: bool) -> Result<Branch<'repo>, Error> {
71+
pub fn rename(&mut self, new_branch_name: &str, force: bool) -> Result<Self, Error> {
7272
let mut ret = ptr::null_mut();
7373
let new_branch_name = CString::new(new_branch_name)?;
7474
unsafe {
@@ -100,7 +100,7 @@ impl<'repo> Branch<'repo> {
100100

101101
/// Return the reference supporting the remote tracking branch, given a
102102
/// local branch reference.
103-
pub fn upstream(&self) -> Result<Branch<'repo>, Error> {
103+
pub fn upstream(&self) -> Result<Self, Error> {
104104
let mut ret = ptr::null_mut();
105105
unsafe {
106106
try_call!(raw::git_branch_upstream(&mut ret, &*self.get().raw()));
@@ -129,7 +129,7 @@ impl<'repo> Branches<'repo> {
129129
///
130130
/// This function is unsafe as it is not guaranteed that `raw` is a valid
131131
/// pointer.
132-
pub unsafe fn from_raw(raw: *mut raw::git_branch_iterator) -> Branches<'repo> {
132+
pub unsafe fn from_raw(raw: *mut raw::git_branch_iterator) -> Self {
133133
Branches {
134134
raw,
135135
_marker: marker::PhantomData,

src/buf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Default for Buf {
2222

2323
impl Buf {
2424
/// Creates a new empty buffer.
25-
pub fn new() -> Buf {
25+
pub fn new() -> Self {
2626
crate::init();
2727
unsafe {
2828
Binding::from_raw(&mut raw::git_buf {
@@ -56,8 +56,8 @@ impl DerefMut for Buf {
5656

5757
impl Binding for Buf {
5858
type Raw = *mut raw::git_buf;
59-
unsafe fn from_raw(raw: *mut raw::git_buf) -> Buf {
60-
Buf { raw: *raw }
59+
unsafe fn from_raw(raw: *mut raw::git_buf) -> Self {
60+
Self { raw: *raw }
6161
}
6262
fn raw(&self) -> *mut raw::git_buf {
6363
&self.raw as *const _ as *mut _

0 commit comments

Comments
 (0)