Skip to content

Commit 74badca

Browse files
committed
simplify
1 parent c12beb7 commit 74badca

File tree

5 files changed

+16
-32
lines changed

5 files changed

+16
-32
lines changed

+stdlib/file_checksum.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
hash = sprintf('%.2x', hash);
4343

44-
if isa(file, "string")
44+
try %#ok<TRYNC>
4545
hash = string(hash);
4646
end
4747

+stdlib/get_shell.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
s = getenv("SHELL");
88

9-
d = "";
10-
11-
if isa(d, "string")
9+
try %#ok<TRYNC>
1210
s = string(s);
1311
end
1412

+stdlib/h5variables.m

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@
2222

2323
ds = finf.Datasets;
2424

25-
if ischar(file)
26-
if isempty(ds) %#ok<UNRCH>
27-
names = [];
28-
else
29-
names = {ds.Name};
30-
end
25+
if isempty(ds)
26+
names = [];
3127
else
32-
if isempty(ds)
33-
names = string.empty;
34-
else
35-
names = string({ds.Name});
36-
end
28+
names = {ds.Name};
29+
end
30+
31+
try %#ok<TRYNC>
32+
names = string(names);
3733
end
3834

3935
end

+stdlib/ncvariables.m

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,14 @@
2323

2424
ds = finf.Variables(:);
2525

26-
if ischar(file)
27-
if isempty(ds) %#ok<UNRCH>
28-
names = [];
29-
else
30-
names = {ds.Name};
31-
end
26+
if isempty(ds)
27+
names = [];
3228
else
33-
if isempty(ds)
34-
names = string.empty;
35-
else
36-
names = string({ds.Name});
37-
end
29+
names = {ds.Name};
30+
end
31+
32+
try %#ok<TRYNC>
33+
names = string(names);
3834
end
3935

4036

+stdlib/private/jPosix.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
function s = jPosix(o)
22

3-
d = "";
4-
53
if isempty(o)
64
s = "";
75
else
86
s = o.toString();
97
end
108

11-
if isa(d, "string")
12-
s = string(s);
13-
end
14-
159
s = stdlib.posix(s);
1610

1711
end

0 commit comments

Comments
 (0)