Skip to content

Commit

Permalink
Remove useless variable declarations in trailing position (#11704)
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil authored Jan 13, 2022
1 parent 69e0cf2 commit c783cc4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spec/compiler/crystal/tools/playground_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ private def assert_compile(source)
sources = Playground::Session.instrument_and_prelude("", "", 0, source)
compiler = Compiler.new
compiler.no_codegen = true
result = compiler.compile sources, "fake-no-build"
compiler.compile sources, "fake-no-build"
end

describe Playground::Session do
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/codegen/codegen.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ module Crystal
thread_local_fun = check_main_fun(fun_name, thread_local_fun)
indirection_ptr = alloca llvm_type(type).pointer
call thread_local_fun, indirection_ptr
ptr = load indirection_ptr
load indirection_ptr
end

def visit(node : TypeDeclaration)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/command/format.cr
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class Crystal::Command

# This method is for mocking `Crystal.format` in test.
private def format(filename, source)
result = Crystal.format(source, filename: filename)
Crystal.format(source, filename: filename)
end

private def error(msg)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/util.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module Crystal
)
source = source.lines if source.is_a? String
line_number_padding = (source.size + line_number_start).to_s.chars.size
lines_with_numbers = source.map_with_index do |line, i|
source.map_with_index do |line, i|
line = line.to_s.chomp
line_number = "%#{line_number_padding}d" % (i + line_number_start)
target = i + line_number_start == highlight_line_number
Expand Down
2 changes: 1 addition & 1 deletion src/crystal/system/file.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Crystal::System::File
raise "Invalid file open mode: '#{mode}'"
end

oflag = m | o
m | o
end

# Closes the internal file descriptor without notifying libevent.
Expand Down
2 changes: 1 addition & 1 deletion src/socket.cr
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class Socket < IO
end

def close_on_exec=(arg : Bool)
system_close_on_exec = arg
self.system_close_on_exec = arg
end

def self.fcntl(fd, cmd, arg = 0)
Expand Down

0 comments on commit c783cc4

Please sign in to comment.