diff --git a/Rakefile b/Rakefile index 8b04c37..65936e2 100644 --- a/Rakefile +++ b/Rakefile @@ -30,12 +30,6 @@ task :build_src do sh "cargo build --release" end -desc "Build Rust extension" -task :test_build_src do - puts "Building extension..." - sh "cargo build" -end - desc "Clean up Rust build" task :clean_src do puts "Cleaning up build..." @@ -68,7 +62,7 @@ task :cargo do sh "cargo test -- --nocapture" end -Rake::TestTask.new(minitest: :test_build_src) do |t| +Rake::TestTask.new(minitest: :build_lib) do |t| t.libs << "test" t.libs << "lib" t.test_files = FileList['test/**/*_test.rb'] diff --git a/lib/faster_path.rb b/lib/faster_path.rb index bd50b05..2040faa 100644 --- a/lib/faster_path.rb +++ b/lib/faster_path.rb @@ -103,7 +103,6 @@ def to_a attach_function :dirname_for_chop, [ :string ], :string attach_function :has_trailing_separator, [ :string ], :bool attach_function :entries, [ :string ], FromRustArray.by_value - # attach_function :free_array, [ FromRustArray ], :void end private_constant :Rust end diff --git a/lib/ffi/plus.rb b/lib/ffi/plus.rb index 24d4a2f..c1eba12 100644 --- a/lib/ffi/plus.rb +++ b/lib/ffi/plus.rb @@ -2,13 +2,11 @@ class FasterPath::Plus < FFI::AutoPointer def self.release(ptr) - !null? and Binding.free(ptr) + Binding.free(ptr) end def to_s - @str ||= begin - null? ? nil : read_string.force_encoding('UTF-8') - end + @str ||= read_string end module Binding