Skip to content

Commit

Permalink
Getting rid off useless assignment cops
Browse files Browse the repository at this point in the history
* Sometimes whole side effect less method calls were just
  leftovers and hence deleted
* #945
  • Loading branch information
PragTob committed Nov 15, 2014
1 parent a1e9ca5 commit 67756ba
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
7 changes: 2 additions & 5 deletions lib/shoes/swt/sound.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ def rawplay(decoded_audio_format, decoded_audio_input_stream)

# Start
line.start
bytes_read = 0, bytes_written = 0
bytes_read = 0
while bytes_read != -1

bytes_read = decoded_audio_input_stream.read(sampled_data, 0, sampled_data.length)
if bytes_read != -1

bytes_written = line.write(sampled_data, 0, bytes_read)
line.write(sampled_data, 0, bytes_read)
end
end
# Stop
Expand All @@ -105,8 +104,6 @@ def rawplay(decoded_audio_format, decoded_audio_input_stream)

def getLine(audioFormat)
# throws LineUnavailableException

res = nil
info = DataLine::Info.new(SourceDataLine.java_class, audioFormat)
res = AudioSystem.getLine(info)
res.open(audioFormat)
Expand Down
2 changes: 1 addition & 1 deletion lib/shoes/swt/text_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def bump_absolutes_to_next_line
def set_calculated_sizes
@dsl.calculated_width = segments.last.width
@dsl.calculated_height = segments.inject(0) do |total, segment|
total += segment.bounds.height
total + segment.bounds.height
end
end

Expand Down
1 change: 0 additions & 1 deletion lib/shoes/swt/text_block/fitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def fit_as_two_layouts(layout, height, width)

# Since we regenerate layouts, we must dispose of first try here.
layout.dispose
layout = nil

first_layout = generate_layout(width, first_text)

Expand Down
7 changes: 2 additions & 5 deletions lib/shoes/ui/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def mk_sample_names
def find_pnum(page)
return 999 if page == 'Search'
TOC_LIST.each_with_index do |e, i|
title, section = e
title = e
return i if title == page
end
end
Expand All @@ -245,7 +245,6 @@ def self.load_docs(path)
sections = (sparts[1..-1] / 2).map do |k2, v2|
meth = v2.split(/^=== (.+?) ===/)
k2t = k2[/^(?:The )?([\-\w]+)/, 1]
meth_plain = meth[0].gsub(IMAGE_RE, '')
h = { title: k2, section: k, description: meth[0], methods: (meth[1..-1] / 2) }
[k2t, h]
end
Expand Down Expand Up @@ -421,8 +420,6 @@ def mk_search_page
flow do
show_header 'Search'
show_toc
pnum, docs_title, docs_description, docs_methods = get_title_and_desc(25)
paras = mk_paras docs_description

flow width: 0.8, margin: [10, 0, 20, 0] do
el = edit_line width: 300
Expand All @@ -442,7 +439,7 @@ def mk_search_page
def search(term)
descs, methods = [], []
PNUMS.each_with_index do |(chapter, section), pnum|
pnum, docs_title, docs_description, docs_methods = get_title_and_desc(pnum)
_pnum, docs_title, docs_description, docs_methods = get_title_and_desc(pnum)
paras = mk_paras(docs_description)
descs << [chapter, section, docs_title, paras] if paras.map { |txt| txt.gsub(CODE_RE, '').gsub(IMAGE_RE, '') }.join(' ').index(term)
docs_methods.each do |docs_method|
Expand Down

0 comments on commit 67756ba

Please sign in to comment.