Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace search(s, t) with something(findfirst(t, s), 0:-1) #101

Merged
merged 1 commit into from Jan 24, 2020
Merged

Replace search(s, t) with something(findfirst(t, s), 0:-1) #101

merged 1 commit into from Jan 24, 2020

Conversation

DilumAluthge
Copy link
Member

The search function has been removed from Julia. (It was deprecated in Julia 0.7 and removed in Julia 1.0).

This pull request replaces all uses of search(s::AbstractString, t::AbstractString) with something(findfirst(t, s), 0:-1).

cc: @musm @vtjnash

@DilumAluthge
Copy link
Member Author

Note: WinRPM.install is currently broken because of the use of search in LibExpat.jl.

@codecov
Copy link

codecov bot commented Jan 24, 2020

Codecov Report

Merging #101 into master will decrease coverage by 1.34%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
- Coverage   30.21%   28.86%   -1.35%     
==========================================
  Files           4        4              
  Lines        1026     1150     +124     
==========================================
+ Hits          310      332      +22     
- Misses        716      818     +102
Impacted Files Coverage Δ
src/xpath.jl 11.73% <0%> (-0.27%) ⬇️
src/LibExpat.jl 81.28% <0%> (-0.08%) ⬇️
src/streaming.jl 77.19% <0%> (+0.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e590a1...8e8f64b. Read the comment docs.

@musm
Copy link
Member

musm commented Jan 24, 2020

Should I go ahead and merge and tag then?

@DilumAluthge
Copy link
Member Author

Should I go ahead and merge and tag then?

Yeah that might be good. Then I can finish fixing WinRPM.

@musm
Copy link
Member

musm commented Jan 24, 2020

These changes look good to me. I'll wait until CI and if they pass will merge and tag.

@musm musm merged commit b6f4bb9 into JuliaIO:master Jan 24, 2020
@DilumAluthge DilumAluthge deleted the dpa/search branch January 24, 2020 16:36
@@ -22,7 +22,7 @@ wc = wrap_c.init(
clang_extraargs,
(th, h) ->
begin
if search(h, "expat") == 0:-1
if something(findfirst("expat", h), 0:-1) == 0:-1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but it would be much more logical to write this instead:

if findfirst("expat", h) === nothing

You could even replace all this block with occursin("expat", h).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I just replaced it with the exact suggestion from the deprecation warning that Julia 0.7 gave me, just to make sure I didn't break anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants