refactor: remove unnecessary local variables

This commit is contained in:
Aleksey Kulikov 2021-10-12 19:21:58 +03:00
parent cfa5268af2
commit 20ca75639d
48 changed files with 446 additions and 237 deletions

View file

@ -189,13 +189,10 @@ class Index with IterableMixin<IndexEntry> {
int contextLines = 3,
int interhunkLines = 0,
}) {
final repo = bindings.owner(_indexPointer);
final int flagsInt = flags.fold(0, (acc, e) => acc | e.value);
return Diff(diff_bindings.indexToWorkdir(
repoPointer: repo,
repoPointer: bindings.owner(_indexPointer),
indexPointer: _indexPointer,
flags: flagsInt,
flags: flags.fold(0, (acc, e) => acc | e.value),
contextLines: contextLines,
interhunkLines: interhunkLines,
));
@ -210,14 +207,11 @@ class Index with IterableMixin<IndexEntry> {
int contextLines = 3,
int interhunkLines = 0,
}) {
final repo = bindings.owner(_indexPointer);
final int flagsInt = flags.fold(0, (acc, e) => acc | e.value);
return Diff(diff_bindings.treeToIndex(
repoPointer: repo,
repoPointer: bindings.owner(_indexPointer),
treePointer: tree.pointer,
indexPointer: _indexPointer,
flags: flagsInt,
flags: flags.fold(0, (acc, e) => acc | e.value),
contextLines: contextLines,
interhunkLines: interhunkLines,
));
@ -255,8 +249,9 @@ class IndexEntry {
/// Returns the UNIX file attributes of a index entry.
GitFilemode get mode {
final modeInt = _indexEntryPointer.ref.mode;
return GitFilemode.values.singleWhere((mode) => modeInt == mode.value);
return GitFilemode.values.singleWhere(
(mode) => _indexEntryPointer.ref.mode == mode.value,
);
}
/// Sets the UNIX file attributes of a index entry.